Plain Text Accounting

Plain Text Accounting (also known as PTA) is a term I arrived at by accident.

For controlling my finances I've used Excel files for a long time, but since I use Linux I've had to deal with OpenOffice and LibreOffice... which kind of work, but aren't great, and above all, LibreOffice Calc 7 is so painfully slow both opening itself and saving files (even if they are tiny less than 10KB ones!).

After months of frustration and trying different approaches, like separate files per year or minimizing the amount of data, I recently gave up and decided to search for "as simple as possible alternatives". I also wanted to avoid "the cloud", because I don't use Office Online nor Google Docs and won't change my mind only because of this single reason.

I tried searching for "text based accounting", and I found "plain text accounting"... Or to be more precise, ledger, a CLI and plain text-based double-entry accounting system.

ledger's documentation looks initially quite daunting, with so many options, and features, and ways of writing your finances. But I strive for simple solutions, so just reading the very basic introduction and checking some examples, I realized I can already use it in a practical way with a minimal subset of the features it provides. And then I can slowly improve my skills with the software, or simply leave as it is if serves me well enough.

Sometimes an example is both easier and enough, so let me begin with a minimal one:

2022/06/01 Miscellaneous
  Expenses:Services:ServiceA       $ 123
  Expenses:Assorted:Eating         $ 456
  Expenses:Phone                     $ 5
  * Assets:Checking

2022/06/02 Employer
  * Assets:Checking              $ 10000
  Income:Salary

; this is a sample comment

First, we have an entry line (labelled Miscellaneous), with three line items, Classified as category Expenses (and some sub-categories) and a fourth entry line that refers to Assets:Checking. That last line makes ledger know that previous amounts need to be deducted (in this case, from an initial amount of $ 0). We also have another entry (Employer), containing in this case first a line item with an amount associated with Assets:Checking and an empty Income line item, so ledger adds the amount to the checking asset instead of subtracting from it.

I am still learning the way the formatting works, so there might be even more minimalistic approaches, but this works for me.

Running the CLI tool (I like the Docker way) we get:

docker run --rm -v "$PWD":/data dcycle/ledger:1 -f /data/sample.dat register checking
22-Jun-01 Miscellaneous         Assets:Checking              $ -584       $ -584
22-Jun-02 Employer              Assets:Checking             $ 10000       $ 9416

We can see how it properly deducts expenses and adds incomes, listing all entries ordered by date, and displaying at the rightmost column the balance result. So the last entry line's rightmost column represents the final balance.

While this initially looks cumbersome compared with adding numbers and labels on GUI cells, in the end is mostly similar at a conceptual level, and I haven't had to do any manual summing or counting either. Plus I have something that is quite portable to a future different system if I ever want to, and is blazingly fast.

I moved my current month finances to the system and all numbers matched perfectly, so from now on this is what I'll use.

Tags: Finance Offtopic Tools

Plain Text Accounting article, written by Kartones. Published @