We have all been there. You earn that lucrative IT-sector big buck, and next thing you know, you are down to 10% of your earning by the middle of the month. You don't even know how you spent the money. Then you can only vaguely recall buying some shirts and shoes and some newest technology thingamajigs. “What the f#*k did I spent this half a thousand buck on?” is the question that stuck will in your mind until next month, and then the cycle will repeat.

Alright so how can we fix this problem, break the cycle and live happily ever after. Let's work on this issue, iteratively, Agile style.

A balance book

Okay, I did think about doing this back in the day, but I always forget to bring a notebook with me. Also, I don't like writing on paper that much. Guess I'm the opposite of the nostalgic people.

The pros of this solution are:

  • Darn easy to adopt. You need $1 for a notebook and pencil, and you can start cracking at it.
  • The tried and true method that merchants of old had employed for a thousand of year. The Dutch East Indies accounting is done on paper, yet they conquered a large swath of the world.

The cons: it's the 2020s already. You have already paid a ton of money for your phone and computer, make use of it. Do you really think you can crunch a few hundred numbers effectively without making a mistake? Not all of us are born to be good at math.

This is such a weird movie, prop's to Ben Affleck for making it watchable

We look to the next solution, an automated, digitalized version of the accounting book: a spreadsheet

A spreadsheet

One improvement that you can immediately think of digital-based medium over their physical counterpart is that they are more resilient through the mean of replication. You can make some copies of the data, put one on the cloud, and it's less likely that your accounting will be ruined by a carelessly placed cup of water.

Excel/Google Sheet/LibreOffice Calc/Apple Number to the rescue! You get automatic calculation, charts. With cool colors to tie them all together.

Not mine, but it looked sorta like this. I lost my old spreadsheet file

Actually, I'd argue that the biggest advantage of digital-based medium lie in the +C, +V combination (or Ctrl+C, Ctrl+V if you refuse to use Apple). It's 2024, we can surely export our banking statement into a CSV file and copy-paste the data in your spreadsheet.

That was what I did, for about 2 weeks. I exported the bank account statement, every day, then copy and paste it in the spreadsheet. Everything gets updated automatically. That was such a breeze comparing to holding on your calculator.

But, the thing with spreadsheet is, they are just not specialized for any task. The formula, placement, color, etc. are your responsibility. So it makes it kind of easy to break the thing if, for example, you add more rows than what the formula accounted for.

This is a case of when users stray from the golden path. Every process will have a scenario where everything goes well, and everybody is happy. But also, most process will have countless way for someone/something to do an unexpected thing. That's the weakness of setting up business logic on a spreadsheet, because you can do a lot of things that are unexpected: typing at the wrong box, delete a formula, shift a cell that mess up all referenced ranges. You don't want to crap your whole carefully constructed financial plan every day, so there's got to be someway to fix this.

The next step on our journey to improve our financial tracking, should be AN APP

Your own app

Applications have the perk of codified business logic. Let me explain. How you interact with applications is predefined in code, every case, every possibility (unless the developer forgot to handle an unexpected error). The idea is that, in your day-to-day operation, the app holds your hand and guide you through a series of steps to update & maintain a certain data State, which should correspond to all your financial data. You will not accidentally change any fundamental behavior of the application, because it is expressed in the application's code.

And besides, it looks better.

The UI of YNAB, probably. I haven't used YNAB

So now I am faced with two choices: pick an app on app store and use it (possibly giving my spending habit to god-knows-how-many 3rd parties), or, build my own app. Being somebody who knows how to code, I have to go with the second choice.

The application is fully public: https://github.com/antran22/budgeteer. You may/may not get some inspiration from this code, after all, it was written by a college student.

Budgeteer is my first foray into Mobile App development. Thank God for Flutter, because, as I would gradually learn, doing semi-good looking UI on native Android/iOS is kinda a full-time profession. I am very proud of Budgeteer, because it is quite usable, and I daily drove it for a few months. The app is written to fit my budgeting flow, with 2 main use cases:

  • Logging transaction & see some kind of analytic/summarization
  • Setting a budget.

It handles the first use case well. As for the second use case, I cooked up a very nice wish-list feature, mainly to curb my spending frenzy. The idea is that, when I want to buy something, I have to write it into the wishlist. Then the application make me “think” about whether I really need to buy this. The higher the price, the longer the wait. After the “thinking duration”, I can press a button to actually commit this wishlist item into the budget.

Overall, the application works as expected. I even used the same application, with some tweaks, to submit for 2 different school subjects. I didn't build an iOS version for it, but I sent the APK file to some of my friends, and it was quite warmly received. As far as app building goes for a college freshman, that was a small success.

Then I stopped using it.

Other people's code

It takes way more effort to think through about developing an application. There are edge cases during handling of data. Then there are things that you don't know you should have done, like some way to do data backup, or some way to show/share your transaction. If you did not think through all those small-but-not-minor problem, the user will encounter friction, and lose interest in the app.

But in reality, I'm just lazy to write more code. I also moved from Android to iOS, and at the time I didn't know of any way to sideload an application onto my phone without shedding 99 bucks for Apple (there are tools to do this now, ex. Sideloadly or AltStore). I stopped using the app, and consequently, stopped tracking my finance for 2 years. It was 2 years of tumultuous financial issues, luckily I hadn't made that much money, or else I would have been losing a lot more on frivolous stuffs.

That was until I jumped on the Homelab/Self-host bandwagon. If you have a spare computer lying around, try doing this yourself. You will be surprised that there is a huge amount of free, open-source, or at least self-hostable applications, to perform a lot of daily-life functions. One of those application that I found was Actual Budget.

Actual is very mature. That is to say, its feature-set is fully developed and used by a community. Their development is now also totally community based. I personally find their envelope budgeting model very intuitive. One of the most powerful capability of Actual is its local-first data sync model. Instead of having all your transaction data on a server with the risk of data leak, Actual will pull the full ledger book to your device, which can optionally (and should) be end-to-end encrypted. This way you can use Actual when your network is out, and perform a data sync when you can reconnect to the server.

Automate the transaction input

The as a developer part in the title is actually really important. Let's take an excerpt from Google's Book for SRE, chapter 5: Reducing Toil.

If a human operator needs to touch your system during normal operations, you have a bug. The definition of normal changes as your systems grow.

What the hell does this have to do with managing finance, you ask. The SRE principle of reducing toil - manual works is based on the fact that manual works are prone to error. In this particular scenario, inputting transaction manually is toil – doing this entirely manually is very tiresome for me. I will forget to do this every other day, and when the transaction backlog grows to 20 entries, I will be very hesitant to sit down and input them by hand. If you are more disciplined than me, you probably will be fine with this. For me, I need a different solution. And that solution needs to be an automated workflow.

Interacting with Actual

Actual has an api package. The interesting thing about this API package is that the backend does not have an API in the sense of REST/RPC API endpoints. The API package does exactly the same thing as the web interface, it has to pull the ledger book back and decode it. You write stuffs to the ledger book, then push the whole piece back to the server for safe-keeping.

Interacting with the Bank

The state of open-banking in Vietnam is, to say the least, bad. There is almost no initiative for this. You cannot build a financial solution on top of a bank's data, without signing some multi-million contracts with them. So I would reverse engineer the bank's API from their frontend. This is, of course, kinda illegal. I don't want the bank suing me, or even if they don't, lock me out of this API, so I'm not going to name the bank here or give any instruction for it.

Sidebar, to bank developers, I'll even pay a premium for access to a personal API. If one day the bank I am using break the API, I'll try to move to another one.

Putting it all together

With some JS scripting, you will be able to:

  • Pull the bank transaction data.
  • Transform it to Actual format.
  • Push the transaction into Actual & sync.

Because this script is highly specialized, there is not much use in being able to extend it. I will package it into a Docker image, and push a K8s Cronjob to execute it daily.

Conclusion

For me, managing my financial situation is something I would begrudgingly do, and so I'll try my best to cut my cognition load on doing this as much as possible. The challenge of scripting some workflow to automate this process is particularly rewarding. However, this only solves part of the problem, the part of tracking my spending. Being disciplined and limit your spending is a different problem and you need to approach this with commitment.

How I manage my finance (as a developer)