Now updated for Beancount 3!
Published
In this article we'll take a quick look at the main account types in Beancount.
Beancount, if you're not familiar with it, provides an implementation of the double entry bookkeeping primitives in Python. If you'd like to learn more about Beancount or about the plaintext accounting ecosystem first, I would recommend checking out the previous blog post I wrote on the topic.
If on the other hand you're already familiar with the concepts, let's dive right in!
Accounts in the Beancount world are slightly different from accounts in the real world.
If you think about the real world, an Account is something that, for the most part, you have at the bank. It's where you store money. It's where you use money from. It's something that has a physical existence. In the Beancount world, an Account does not necessarily have to be physical. A physical account is just one type of an account.
Accounts in Beancount exist to track money between various sources. So, for instance, if you want to track how much money you're spending on groceries every month, that would be one account. If you want to track how much you're paying on online subscriptions each month, that's another account. You can have as many accounts as you want, each for a specific purpose. In fact, it's not uncommon to have hundreds, or even thousands of accounts in a Beancount ledger.
With so many accounts, it makes sense to divide them into a few categories. Beancount provides (mainly) four. Well technically, it provides one more, but we'll ignore that to limit the scope of this blog post. Let's take a look at each of those.
The first type of account is an Asset
account. Asset accounts generally represent
things you have or things you own.
We talked about bank accounts in the previous section. In the Beancount world, an
account you have at a bank would be one type of an account. If, for instance, you have a
debit account and a credit account, you could represent them using account names like
Asset:AcmeBank:Debit
and Assets:AcmeBank:Credit
.
Asset accounts typically have a positive value, because these accounts represent something that you own.
Liability accounts, as it may sound like from the name, represent money that you owe
someone else. For instance, if you buy a home and take out a loan from a bank, you could
represent this in your Beancount ledger using an account like Liabilities:AcmeBank
.
The value of such accounts is generally negative. Over time, the value of such an account will become less negative as you transfer money to the other entity. And at some point when all of it has been paid off, the value will drop to zero.
Income accounts represent money flowing in to your bank (or to one of your Asset
accounts). Generally, money flows in to these accounts when you receive money from
someone else (for instance, when you receive your salary from your employer).
As an example, if the company you work at is called Acme Corp, then you could represent
it in your Beancount ledger using an account like Income:AcmeCorp
.
These accounts tend to have negative values. This might be somewhat counter intuitive
because from your point of view, income is something positive. But if you think of it in
terms of the flow of money, note that money flows to an Asset
account
(representing your bank account) from your Income
account, it makes sense for
Income
accounts to have negative values.
Expense accounts are probably the account type that you'll use the most in your
Beancount ledger, as they represent your everyday transactions. Things like supermarket
expenses, vacations, eating out, etc. can all be represented using Expense
accounts.
It's not uncommon to have a lot of such accounts in your Beancount ledger. In fact,
at the time of this writing, my own ledger has more than 900 expense accounts.
Expense accounts generally tend to have positive values. This can again be somewhat
counter intuitive, because from your perspective, expenses represent money you give to
someone else. But as with Income accounts, it's about perspective. Let's take the
supermarket as an example. When you buy groceries, the money is flowing from your
Asset account to the Expenses:Supermarket
account. So the fact that the money is
flowing in to the account means that the overall value of such an account adds up to
something positive.
In conclusion, understanding the different account types in Beancount is helpful to gain an understanding of how to classify the accounts in your Beancount ledger. When I started using Beancount, understanding the account types was one of the things that helped me gain a big-picture understanding of the way things worked. I hope this article was helpful to you in the same way!