Open CalvinChanCan opened 4 months ago
What's the difference between using this and uploading transactions to an account?
This API allows you to set the balance history on an account irrespective of the transactions. For my use case, I use this API to sync nightly the value of my brokerage accounts with Monarch. There's no transactions to report, the value just fluctuates every day.
@CalvinChanCan - Thanks for putting this PR together! I've been meaning to contribute back some local hacks I had to account for the changes made to the API... but this PR is much more complete!
Hi @hammem, just wondering if I could get another review. Happy to make any further changes/feedback.
I pulled down this code to try and use it. can you please give example input? How do I use BalanceHistoryRow?
Hi @CFarzaneh ,
You can import the class BalanceHistoryRow
. With this class, you only need to provide the date (as a datetime object), an amount as a float, and optionally, can you include the account_name.
Example:
rows_list = []
row = BalanceHistoryRow(
date=datetime.datetime(2020, 1, 1),
amount=17.00,
account_name='Chase Bank Account',
)
rows_list.append(row)
mm.upload_account_balance_history(account_id='1700000000000', csv_content=rows_list)
@CalvinChanCan , apologies for the delay on this. Just a couple of minor things and this is ready to go. Once you are ready, I'll merge and do a release with this as well.
@CalvinChanCan , lmk if you'd like this included in the next release to PyPI!
This PR improves on the upload account balance history.
The method
upload_account_balance_history
only uploads the CSV file but does not update the balance in Monarch Money.A new method
parse_upload_balance_history_session
is added to parse the csv file which would cause an update to the account balance history.Another new method
get_upload_balance_history_session
is added to check the status of whether the parsing is still processing or completed.Finally
upload_and_parse_balance_history
uses these 3 methods together to upload and parse the account balance history so that it shows up in Monarch Money.