By Will Thong, Thu 14 September 2017, in category Programming
I want a budgeting system simple enough to tell me how much I am allowed to spend on a daily basis, but comprehensive enough that this figure will be an accurate reflection of reality. Alex Recker’s bennedetto (the conception of which is charted in this highly-recommended article) fits these criteria well. Drawing inspiration from turn-based strategy games, Recker’s model conceptualises the budget as how much ‘treasure’ (ie disposable income) one has available to spend per day, week, month and year, taking into account all regular income (eg salary) and outgoings (eg rent or utilities). Anything irregular (eg dinner at a restaurant, an impulse-purchase jacket or groceries) is subtracted from that day’s, week’s, month’s and year’s remaining treasure, giving us a final amount of money we can continue to spend while remaining solvent, and which would be saved if we do not spend any more.
I enjoyed setting up and using Bennedetto, but there were several problems with it:
I decided to explore Ledger
instead (worth a read, as some of the below may be confusing if you don’t
understand the philosophy behind how Ledger works). There are several tools
which allow you to simply and efficiently convert data from a bank (for instance
in CSV format) to Ledger’s format. While using
icsv2ledger, all I need to put in
for each transaction is a description (eg Aldi
) and an account (eg
Expenses:Groceries
). This is made even faster by autocomplete settings which
intelligently look at your previous inputs to suggest what you might mean. Data
is stored in a plain text file, so it can be accessed with any text editor (I
use Vim with the vim-ledger plugin). It
also operates from the command line, which makes it really easy to script.
I wrote an app which would emulate the most important feature of Bennedetto: taking all your regular income, subtracting your regular outgoings and giving you a figure for disposable income per day, week, month and year. It required some tricky workarounds because Ledger’s documentation is incomplete and extremely confusing in places, but I got there in the end. The result, turningledge, is open source and available here.
Bob Smith earns a take-home salary of £30,000 a year. He expresses that as amonthly figure by recording a negative budgeted amount at the top of his Ledger file.
~ Monthly
Income:Salary £-2500.00
Assets
The budgeted figures at the top of the Ledger file listed in this way do not impact the actual transactions which, totalled together, form the accounts. They serve a bit like a ‘shadow’ Ledger, describing an idealised version of how Bob spends.
On the other hand, there are also things which regularly take money out of Bob’s assets, which he should also put into the budget section:
~ Monthly
Income:Salary £-2500.00
Expenses:House:Rent £600.00
Expenses:Amazon Prime £10.00
Expenses:House:TV Licence £5.00
Expenses:House:Broadband £10.00
Expenses:House:Gas £50.00
Expenses:House:Electricity £40.00
Expenses:Medicine:Contact Lenses £40.00
Expenses:Tech:Mobile Bill £10.00
Assets:Bank:Savings £300.00
Assets
A few things are worth noting here. First, these are all monthly figures; although Bob may be charged for somethings on a non-monthly basis, in those cases he will need to divide quarterly costs up into three, annual costs into 12 and multiply weekly costs by four. Second, these are clearly rounded numbers, but a real Ledger file will have less clean figures. Third, the line about savings represents the £300 Bob squirrels away each month. Although he is not paying it away externally, he nonetheless loses access to it as immediately disposable income, so it becomes locked away and is an expense for the purposes of his daily number. Indeed, this will later require Bob to declare the savings when it comes to customising turningledge.
Having worked out his regular income and costs, Bob can then run turningledge to find how much he will be able to spend each day while living within his means (that is, without going into debt). If he runs it, turningledge will deduct his expenses from his income and return the following:
Allowable spending
==================
Today: £ 47.14
This week: £ 330.03
This month: £ 1435.00
This year: £ 17220.00
To celebrate this fantastic discovery, Bob goes out for dinner and a drunken spree with some mates, where he orders a pretty huge round. These transactions are listed in the ‘real’ section of the Ledger as follows (bear in mind if you’re following along with the example that you’ll need to change the dates of the transactions to today for it to work, otherwise turningledge will think these were costs you incurred in the past rather than today):
14/09/2017 * Pizza Express
Expenses:Fun:Eating Out
Assets:Bank:Current Account £-30.00
14/09/2017 * The Hammer and Sickle
Expenses:Fun:Drinking
Assets:Bank:Current Account £-80.00
These unbudgeted expenses are subtracted from his treasure for the day, week, month and year, dropping his remaining daily allowance below zero:
Allowable spending
==================
Today: £ -62.86
This week: £ 330.03
This month: £ 1435.00
This year: £ 17220.00
However, Bob’s bender has clearly not had the same impact on his weekly treasure. In other words, Bob only needs to be a bit frugal for the next few days before his daily unspent treasure begins to add up and make up for this particular mistake. Of course, a huge impulse purchase like a £3,000 TV might impact Bob’s finances for the whole year; turningledge is useful for Bob to work out the medium-term consequences of his actions, allowing him to adjust accordingly.
I intend to rewrite the app in Python, not having realised I could call command line options from it thusly. I would also like to implement the ability to create graphs, one of Bennedetto’s cooler features.