hammem / monarchmoney

Python API for Monarch Money
MIT License
124 stars 24 forks source link

Add queries for net value, recent daily account values #93

Closed keegandahm closed 3 months ago

keegandahm commented 4 months ago

This PR adds 3 queries, for retrieving aggregateSnapshots, snapshotsByAccountType, and accounts.recentBalances.

recentBalances is used by the web app to retrieve the daily value of a given account, primarily to generate the sparklines seen on the Accounts page.

snapshotsByAccountType is used by the web app to generate the bar charts showing different account types' contributions to your net worth, on the Accounts page.

aggregateSnapshots is used by the mobile app to show your historical daily net worth, or to see the historical value of certain account types, e.g. cash, loans, brokerage, etc..

hammem commented 3 months ago

@keegandahm , if you'd like this included in the next PyPI version, please update with requested changes and I'll merge it in. Thanks!

keegandahm commented 3 months ago

Hey @hammem, just give me a bit and I'll add these changes today

keegandahm commented 3 months ago

Hey @hammem, I've made the changes you requested.

Regarding moving the library over to date types, I'm generally in favor of leaning on the type system to enforce valid arguments to an interface, even with dynamically typed languages like Python. Having date objects means developers don't have to think about how the argument is formatted, and that if they give you a date object, you can guarantee a correctly formatted request.

That said, consistency is also very important. One way I can think of to softly transition existing functions to date arguments is to only document using them with dates, but support both by checking the type of the argument and acting appropriately.

Let me know if there are any other changes you want, thanks!