Beancount DKB

Last week I open-sourced beancount-dkb, which is a Python package that provides importer classes for converting CSV exports of DKB (Deutsche Kredit Bank) account summaries into the Beancount format.

For the past few months, I've been looking into keeping tabs on my personal expenses. There are plenty of tools that let you do that. The problem is, I don't like the idea of a single company having access to all my bank accounts. I honestly don't care what the privacy policy says or what's in the security whitepaper. I've worked at enough software companies and talked to enough software engineers to know how things really work.

While searching, I stumbled upon the concept of Plain Text Accounting. The concept is simple - you maintain a list of all your transactions in a plain text file, which you are responsible for curating (hence no external access). This list of transactions follows the Double Entry Accounting method, and is written in a domain specific language (which may vary slightly from tool to tool).

This workflow is quite appealing. You download your account statements/summaries from your bank's website, run them through a script to convert them to a format that your tool of choice works with, and then run reporting on top. There are multiple such tools available to adopt this flow, the most prominent ones being ledger, hledger, and beancount. I settled on using beancount simply because I like Python.

The only problem was that my account is with DKB, and there were no existing conversion helpers to convert the CSV that I get from DKB to a format that beancount can work with.

Luckily, beancount defines how to ingest external transaction data. The idea is to implement a class that sticks to the beancount.ingest.importer.Importer interface provided by beancount. The main job of this class is to take the raw transactions data from your bank and output data in the beancount format.

This ingestion is extremely well documented. So I spent a weekend writing two such importer classes - ECImporter (which works with EC account summaries), and CreditImporter (which works on Credit Card account summaries). I've used it to import my own transaction data starting from 2015 onwards, and the entire setup works extremely well.

Anyway, the module is on PyPI under the name beancount-dkb, and the source is on Github. Hope it's useful!