Plain text accounting with Beancount

Friday, Jun 16, 2017

Plain text accounting with Beancount

I’ve been using GnuCash to take control of my finances for 18 years, so I’ve always been reluctant to mess with a system that mostly works. Even though I’ve been noticing the flaws in an otherwise great piece of software, like a cumbersome account balance process, and lack of meaningful reports.

Since I work most of the time with a command line open, and have incorporated very powerful tools into my workflow (like Vimwiki, which I’ve written about before), I have always felt intrigued by the plain text accounting tools like Ledger.

I then found Fava, a very modern and attractive interface to finance reports made in Beancount, an opinionated alternative to Ledger. Beancount is mainly a way to format a text file (or group of files), and a suite of scripts written in Python that allow you to interact with the files: check that they are correctly formatted, generate text or HTML reports, or even write your own queries in a SQL-like language.

A small difference between Beancount and GnuCash is the use of positive and negative amounts, as opposed to debit/credit, which is the traditional style of handling accounting. Once you get over that, it’s easy to fall in line with the requirements of the format.

One of the main features that won me over was the use of account balances as first-class citizens in the program: once you declare your ending balance for an account on a certain date, any transactions that alter that balance will be flagged as errors, either by the beancount-check script, or by the Fava interface.

Another great feature is being able to tag a group of transactions as belonging to the same category. I can then have an exact figure of how much we spent on a vacation trip, taking every expense into account: from hotel and airline tickets (typically placed in a travel expenses category), to restaurants and events (typically placed in their own food and entertainment categories).

I’ve since moved all of my accounts over to this method, and I can even handle complex lot-based costs for stocks or mutual funds. It’s allowed me to get current with our spending and the state of our investments.