Skip to main content

Introduction to Beancount.io

· 5 min read
Mike Thrift
Mike Thrift
Marketing Manager

Why Modern Bookkeeping Matters

Still managing your investments with spreadsheets? While spreadsheets are versatile, they can become cumbersome and error-prone as your investment portfolio grows. Enter Beancount.io – a sophisticated yet user-friendly investment tracking platform designed specifically for managing stock and cryptocurrency portfolios. Built with engineers and financial minimalists in mind, Beancount.io combines powerful features with an intuitive interface to streamline your investment tracking experience.

2019-09-07-introduction-to-beancount

Expenses

Income Statement

Balance Sheet

Double-entry Bookkeeping: The Foundation of Accuracy

Beancount.io is built on the principles of double-entry accounting – a time-tested methodology used by financial institutions worldwide. This system ensures mathematical accuracy through a simple yet powerful concept: every financial transaction must balance perfectly.

In double-entry bookkeeping, each transaction requires at least two entries – a debit (+) and a credit (-) – across different accounts. This built-in verification system makes it virtually impossible to record unbalanced transactions, ensuring your financial records remain accurate and reliable.

1970-01-01 open Income:BeancountCorp
1970-01-01 open Assets:Cash
1970-01-01 open Expenses:Food
1970-01-01 open Assets:Receivables:Alice
1970-01-01 open Assets:Receivables:Bob
1970-01-01 open Assets:Receivables:Charlie
1970-01-01 open Liabilities:CreditCard

2019-05-31 * "BeancountCorp" "Salary of May 15th to May 31st"
Income:BeancountCorp -888 USD
Assets:Cash 888 USD

2019-07-12 * "Popeyes chicken sandwiches" "dinner with Alice, Bob, and Charlie"
Expenses:Food 20 USD
Assets:Receivables:Alice 20 USD
Assets:Receivables:Bob 20 USD
Assets:Receivables:Charlie 20 USD
Liabilities:CreditCard -80 USD

As you can see in the two examples above, every transaction must fulfill the accounting equation.

Assets = Liabilities + Equity(aka Net Assets)

We used the Beancount syntax by Martin Blais and the web project Fava by Jakob Schnitzer to build this website. And it will alert you if any transaction has any legs not summing to zero.

Error Alert

Now you understand how we enforce the correctness of the ledger. But you may ask what are those "accounts"?

Understanding Accounts: The Water Bucket Analogy

Think of your financial accounts as a system of interconnected water buckets, where money flows like water between them. This analogy makes double-entry bookkeeping intuitive: when you transfer money from one account to another, it's like pouring water from one bucket to another – the total amount of water (money) in the system remains constant.

Beancount.io introduces five kinds of accounts.

  1. Income — Its amount is always negative or in debit. This is because you are making money, and then the money is debiting from "Income" account and crediting to your "Assets."
  2. Expenses — Its amount is always positive or in credit. This is because you are spending money, and the money is flowing from the "Assets" or "Liabilities" to the "Expenses."
  3. Liabilities — Its amount is positive or zero. Your credit card liabilities are a good example, which rises and falls in cycles.
  4. Assets — Its amount is positive or zero. Your cash or houses are always worth some prices.
  5. Equity — Your net assets. The system will calculate automatically for you. Equity = Assets - Liabilities and it reflects how wealthy you are.

Now you can open your customized accounts with those keywords above:

1970-01-01 open Assets:Cash
1970-01-01 open Assets:Stock:Robinhood
1970-01-01 open Assets:Crypto:Coinbase
1970-01-01 open Expenses:Transportation:Taxi
1970-01-01 open Equity:OpeningBalance

Advanced Investment Tracking with Commodities

Beancount.io excels at tracking diverse investments, from stocks to cryptocurrencies. Let's explore how it handles complex investment scenarios. For example, here's how you would record purchasing 10 Bitcoins at $100 each in 2014:

2014-08-08 * "Buy 10 Bitcoin"
Assets:Trade:Cash -1000.00 USD
Assets:Trade:Positions 10 BTC {100.00 USD}

And then three years later, you sell them (originally with costs of $100 per unit annotated with {100.00 USD}) at the price of $10,000 per unit annotated with @ 10,000.00 USD.

2017-12-12 * "Sell 2 Bitcoin"
Assets:Trade:Positions -2 BTC {100.00 USD} @ 10,000.00 USD
Assets:Trade:Cash 20,000.00 USD
Income:Trade:PnL -19,800.00 USD

Or the same transaction with @@ 20,000.00 USD means that at the price of $20,000 in total.

2017-12-12 * "Sell 2 Bitcoin"
Assets:Trade:Positions -2 BTC {100.00 USD} @@ 20,000.00 USD
Assets:Trade:Cash 20,000.00 USD
Income:Trade:PnL -19,800.00 USD

The sum of all legs of the transaction, including -2 BTC {100.00 USD}, are still, as always, zero.

The costs {100.00 USD} tag is important because you might have bought the same commodity at different costs.

100 BTC {10.00 USD, 2012-08-08}
10 BTC {100.00 USD, 2014-08-08}

If you want to simplify the process, you can set up the account at the beginning with FIFO or LIFO. FIFO stands for first in, first out, while LIFO stands for last in, first out. In the US, IRS uses FIFO to calculate your PnL and tax accordingly.

1970-01-01 open Assets:Trade:Positions "FIFO"

And then when you sell it in shorthand like -2 BTC {}, beancount will apply FIFO strategy automatically and sell the oldest commodity.

Getting Started with Beancount.io

Beancount.io is a modern cloud-based financial management platform that transforms your text-based transaction records into comprehensive financial statements, including income statements, balance sheets, and trial balances. By combining the reliability of plain text files with powerful visualization tools, Beancount.io helps you maintain precise control over your financial life while gaining valuable insights into your investment performance.

Start your financial journey with Beancount.io - Free during our promotional period!