I use You Need A Budget (YNAB) for my personal budget. It’s an amazing service built up around the idea of “giving every dollar a job”, meaning that you put all the money you have for a given month into a category in your budget. So, after categorizing all your money into “mortgage”, “groceries”, “savings”, etc. you end up with a final amount of disposable income, and this is where I’ve hit a roadblock that’s been annoying me literally for years:
On any given day of the month I want to know how much money I can spend out of my remaining disposable income, e.g. remaining days of the month divided by remaining disposable income. This is annoyingly hard to do with YNAB, because every time I make a transaction I’d have to manually add those transactions to YNAB, see my new disposable amount and calculate my new daily amount. This is not an issue for American YNAB users, because YNAB can automatically import transactions from American banks, meaning you can just check your YNAB app and divide the up-to-date disposable amount with the remaining days of the month. Still somewhat cumbersome, but at least easier than having to manually import transactions.
Also, services like Spiir, that does automatically import transactions from Danish banks, does not help me out here, because the budgetting concept there is built around category spending limits, which I don’t like. So, what I’ve been doing is using the app Pennies, which just allows me to enter an account total, and then it gives me my daily disposable amount. Whenever I buy something I then add a transaction in that app, and it shows me my remaining amount. Obviously, this is not a perfect solution, because Pennies gets out of sync with my actual budget if forget to enter something and I have to manually update the total amount every month.
This all changed, because last week I received a newsletter from YNAB in which they announced their new public API! My eyes lit up! Maybe I could build my own YNAB integration, automatically importing transactions from my bank on a regular schedule, and run that regularly on my Mac Mini server. And if I got that working, maybe I could build a small iOS app that uses the same new API to show me my up-to-date daily disposable amount! The only limitation was how to get my transactions exported from my bank’s online banking service. After a quick Google search I stumbled upon Nordic API Gateway, a service that exposes an API for almost all banks in Scandinavia. I couldn’t believe my luck.
After spending some hours scripting, I now have the following setup:
- Node.js script that exports transactions from my bank and imports these into YNAB. YNAB is really clever about detecting duplicates, so I don’t have to worry about filtering out transactions that were already imported. I just import everything going back 30 days. This runs every 15 minutes using cron.
- Node.js script that fetches my YNAB budget, gets the remaining disposable amount, calculates the daily amount for the remainder of the month and then pushes this info as an iOS Push Notification. This also runs every 15 minutes using cron.
- iOS app which has Push Notifications enabled and receives these from the 2nd Node.js script. When it receives the notification it updates its badge with the amount of money I can spend that day.
This now means I have a nice app icon on my iPhone that always shows a badge number with the up-to-date daily disposable amount I can use.