Rants, Ideas, Stuff

A blog about coding, coffee, and stuff

Budgeting for annual expenses with Hledger

I’ve written about Hledger on this blog before. Today I want to tackle budgeting for annual expenses with it. I have annual payments like my car insurance and tax, that are due in january. Since there are many of these annual payments in january I want to be prepared by saving monthly.

For this post I’ll use a fictional car insurance of 600 EUR /year, that is due every january.

The first thing we need to do is calculate how much we need to budget every month to be prepared to pay the car insurance in january. That isn’t too hard: 600/12=50

On every 1st of a month I transfer my budgeted money to a savings account:

2020/07/01 * Annual Expenses  ; monthly:
  Assets:Checking  -50.00 EUR
  Assets:Savings

Because there are several of these and I want to have an overview over the state of my budgets I use Hledger’s balanced virtual postings to keep my saved money in virtual sub-accounts:

2020/07/01 * Annual Expenses  ; monthly:
  Assets:Checking                -50.00 EUR
  Assets:Savings                  50.00 EUR
  [Assets:Budgets:CarInsurance]   50.00 EUR
  [Assets:Savings]

And when january comes around I can pay my car insurance from the sub-account on my savings account:

2021/01/10 Transfer Car Insurance  ; yearly:
  [Assets:Budgets:CarInsurance]  -600.00 EUR
  [Assets:Savings]                600.00 EUR
  Assets:Savings                 -600.00 EUR
  Assets:Checking                 600.00 EUR

2021/01/10 Pay Car Insurance  ; yearly:
  Expenses:CarInsurance  600.00 EUR
  Assets:Checking

This could be simplified with automated postings but for now I like it this explicit.