Go back ←

Plain Text Accounting

January 08, 2019

A new year is on the road. Deep flows the river of habits and disciplines that could potentially benefit you, but there is something floating on the surface. If you live in a capitalistic West or in a Communistic regime, there is no other way around. Financial literacy, responsibility, and management are essential to your well being.

I don’t spend that much.

Yes, you do. But okay, even if you do not spend that much, whatever that means, amount does not matter. This reply is just ignorant. Certainly, saving the money, cutting the expenses can be part of management, but it is not even near most determining factor in the state of your assets. Managing assets is ancient craft. Wood logs, animals, food, clothing. Nowadays, we mostly use money in form of paper and cards. Goods being abstracted away in the form of paper does not change the importance of assets. Let’s take a simple example. The information that you spend 2000€ yearly on dining will give you drastically different insight than the one that states 10% of all expenses goes on eating out.

I don’t know where it all goes.

Do not be one of them. Those who can not figure out where small little pennies go, should not expect responsibility of hundreds and thousands. Cents of hundreds are thousands of millions. Do the best with what you got.

Journey

I started a few years ago with the spreadsheets. It worked fine as basic valuable information could be extracted. Spreadsheet based software is really powerful and versatile. Down the road, I found myself in a process of making a monster around spreadsheets with all the tables, dropdowns and similar functionality. It is obvious, but worth mentioning that the blame is not on spreadsheets software. I would advise to read and inspect on some organizational systems rather than making your own from scratch. I was giving more in than I was getting out. As time passes, you realize simplicity is a currency on its own. When I became enslaved to the system, exploration for a different solution began. Kayaking through the obstacles, I arrived to a land called plain-text-accounting.

Ledger

Ledger was my choice. While matching the requirements for simplicity, power it will provide, I admit, I did not foresee. Amazing documentation alongside plain-text storage to serve a plethora of users: students, non-profit charities to businesses. We will go through a quick tutorial to see how we can start tracking our finances in a few minutes. Hopefully, you will get a glance on power it provides.

Spreadsheets are good, gnucash also, but I sticked with ledger and it has been stable relationship for last few years. In the second part I will write about basic usage of ledger program. It is easy, you only need a text file.


Tutorial

Initial state

We need a general journal where we enter all our transactions. In ledger, it is stored in a basic file. Let’s say our new year resolution was to start tracking our finances. We did not arrive from outer space. There is already pre-conditioned state/point from which we are starting from. We are ready to enter our first transaction in file.

2019/01/01 * Opening Balances
  Assets:Checking            4200€
  Assets:Cash                 320€
  Equity:OpeningBalance     -4520€

For now, we will keep things really simple, but you can initially get a feeling it can do much more. Stocks, savings… you name it.

Transactions

So after we entered accordingly our current state, we can do a quick observation of a transaction. Transaction consists of:

  • 2019/01/01 Number which obviously is a date.
  • * Which marks cleared transaction state. You can leave it empty or perhaps do a ! for a pending transaction.
  • Opening Balances a description or a payee.
  • Lines in body of transaction are just postings of transaction where you manipulate accounts.

Populating the journal

All transactions must balance to a 0. Otherwise, ledger will throw you an error. That’s the nature of double-entry bookkeeping systems. There are ways to mitigate it, but it is out of scope for this tutorial. You can check virtual postings inside ledger documentation.

Okay, but we bought ourselves a car at the end of last year, and we need to do a licensing and insurance part on it to be able to drive it. We were enabled to pay it by a debit card so we enter:

2019/01/02 * Registration
  Assets:Checking           -325€
  Expenses:Insurance         120€
  Expenses:Car               200€
  Expenses:Car:Parking         5

As you can see, we can establish a hierarchy between accounts using the : . When all set and done, we can go buy some electronics at the mall. But, after all that work the day prior, we first need to do a refuel.

2019/01/03 * Gas Station
  Expenses:Car:Fuel          100€
  Expenses:Food             2.30; Bought a candy bar at a station
  Assets:Cash                       ; Ledger will fill here -102.30;Due to the law of balancing transactions with zero, ledger can automatically finish postings. 
  ;That's why we left our latest posting in last transaction *empty*.

Now you see we can enter comments to do a quick description via

# this is a comment
; this is also a comment
% yep, still ignored
| I am a comment
* Don't forget me

Alright, now we are set to do some proper spending. We will buy a new pc, laptop and television, and we will pay with a credit card.

  Expenses:Electronics      990; pc
  Expenses:Electronics      1400; laptop
  Expenses:Electronics      1049.99; television
  Liabilities:CreditCard:Visa

As a human being, we still need to eat to maintain normal functions working properly. So we will get something quick.

  Expenses:Food              30; Payee: KFC 
  Assets:Cash

You can use Payee: as a special metadata field.

We finally arrive home. We get a notification that our paycheck for December is sealed. When we take a step back we can simply summarize the whole day as a:

2018/01/03 * Gas Station
  Expenses:Car:Fuel          100€
  Expenses:Food             2.30€   
  Assets:Cash                      

2018/01/03 * Mall
  Expenses:Electronics                990; pc
  Expenses:Electronics               1400; laptop
  Expenses:Electronics            1049.99; television
  Liabilities:CreditCard:Visa
  Expenses:Food                        30; Payee: KFC 
  Assets:Cash                         -30€
  Assets:Checking                    3200; Payee: Employer
  Income:Salary                     -3200

Example

Download this journal file to check it by yourself. For a quick reference you can use cheatsheet and documentation.

We reached the end. We explored concepts that will help with tracking finances and guess what, you can start right away by writing it in your .txt file and have it synced across range of devices.

Usage Example

Running basic `balance` command on our journal would look like this.

Last edit on 2020-09-18T16:55:16.7711Z

© 2018.