Deconstructing a Beancount Ledger: A Case Study for Business Accounting
In today's blog post, we will be breaking down a Beancount ledger for businesses, which will help you understand the intricacies of this plain text double-entry accounting system.
Let's start with the code first:
1970-01-01 open Assets:Bank:Mercury
1970-01-01 open Assets:Crypto
1970-01-01 open Equity:Bank:Chase
1970-01-01 open Income:Stripe
1970-01-01 open Income:Crypto:ETH
1970-01-01 open Expenses:COGS
1970-01-01 open Expenses:COGS:Contabo
1970-01-01 open Expenses:COGS:AmazonWebServices
1970-01-01 open Expenses:BusinessExpenses
1970-01-01 open Expenses:BusinessExpenses:ChatGPT
2023-05-14 * "CONTABO.COM" "Mercury Checking ••1234"
Expenses:COGS:Contabo 17.49 USD
Assets:Bank:Mercury -17.49 USD
2023-05-11 * "Amazon Web Services" "Mercury Checking ••1234"
Expenses:COGS:AmazonWebServices 14490.33 USD
Assets:Bank:Mercury -14490.33 USD
2023-03-01 * "STRIPE" "Mercury Checking ••1234"
Income:Stripe -21230.75 USD
Assets:Bank:Mercury 21230.75 USD
2023-05-18 * "customer_182734" "0x5190E84918FD67706A9DFDb337d5744dF4EE5f3f"
Assets:Crypto -19 ETH {1,856.20 USD}
Income:Crypto:ETH 19 ETH @@ 35267.8 USD
Understanding the Code
-
Opening Accounts: The code starts by opening a series of accounts on 1970-01-01. These include a mix of asset accounts (
Assets:Bank:Mercury
andAssets:Crypto
), an equity account (Equity:Bank:Chase
), income accounts (Income:Stripe
andIncome:Crypto:ETH
), and expense accounts (Expenses:COGS
,Expenses:COGS:AmazonWebServices
,Expenses:BusinessExpenses
, andExpenses:BusinessExpenses:ChatGPT
). -
Transactions: It then progresses to record a series of transactions between 2023-03-01 and 2023-05-18.
-
The transaction on 2023-05-14 represents a payment of $17.49 to
CONTABO.COM
fromMercury Checking ••1234
. This is recorded as an expense (Expenses:COGS:Contabo
) and a corresponding deduction from theAssets:Bank:Mercury
account. -
Similarly, the transaction on 2023-05-11 represents a payment of $14490.33 to
Amazon Web Services
from the same bank account. This is logged underExpenses:COGS:AmazonWebServices
. -
The transaction on 2023-03-01 shows income from
STRIPE
being deposited intoMercury Checking ••1234
, totaling $21230.75. This is recorded as income (Income:Stripe
) and an addition to the bank account (Assets:Bank:Mercury
). -
The last transaction on 2023-05-18 represents a crypto transaction involving 19 ETH from a customer. This is tracked under
Assets:Crypto
andIncome:Crypto:ETH
. The{1,856.20 USD}
shows the price of ETH at the time of transaction, while the@@ 35267.8 USD
specifies the total value of the 19 ETH transaction.
-
In all transactions, the principle of double-entry accounting is maintained, ensuring that the equation Assets = Liabilities + Equity
always holds true.
Final Thoughts
This Beancount ledger provides a straightforward yet robust system for tracking financial transactions. As seen in the final transaction, Beancount is flexible enough to account for non-traditional assets like cryptocurrency, which is a testament to its utility in our increasingly digital financial landscape.
We hope this breakdown helps you better understand the structure and capabilities of Beancount, whether you're a seasoned accountant or a beginner trying to keep track of your personal finances. Stay tuned for our next blog post, where we'll delve further into advanced Beancount operations.