I reached a significant financial milestone this month and am focusing on new goals. Like solving a performance problem, you should always measure first.
After poking around at different account aggregation tools, I settled on pocketsmith. Their simple REST API was a main draw:
That task alone wasn't interesting enough, so I wrote a small Clojure library to talk to the API. Ideally, it would leverage something like martian, but my attempt was unsuccessful. That could be a task for the future.
pocketsmith-api uses Joda Time & Joda Money and has 99% code coverage. Because it deals with money, I wanted to ensure it read amounts accurately in various currencies.
That said, Joda Money has some limitations. I have listed some on the README.
Let's build something with it!
Acorns...?
Acorns is a savings tool that, in the past, worked by sending users monthly reports of how much they could save if they rounded up all their charges to the nearest dollar and transferred the difference to a savings account.
They may do more now.
I always thought that idea was excellent but I wanted to avoid paying for it. With Pocketsmith, we can accomplish that easily.
I like to be extra careful when dealing with money. Please verify some elementary assertions before borrowing this code for any purpose. I will demonstrate some tests on my account and list additional applicable checks.
Easy. We can sort the transactions by date and inspect the first and last elements.
(let[me(user)](->>(last-month-chargesme(cardsme))(sort-by:dateclj-time.core/before?)((juxtfirstlast))(mapv#(select-keys%[:date:payee]))));=>[{:date#object[org.joda.time.LocalDateTime0x5df45749"2023-05-01T00:00:00.000"],:payee"SPOTIFY NEW YORK NY P22C7B5A33 XXXXXX1161"}{:date#object[org.joda.time.LocalDateTime0x140ae942"2023-05-31T00:00:00.000"],:payee"DOORDASH*LUNCH BOX CSAN FRANCIS NT_NZXE7CMB +XXXXXXX9470"}]
Does the math make sense? ✓
We can do this by taking 10 of the transactions and eyeballing the numbers.