Beancount Cheat Sheet

After using beancount.io for a while, I find it still not easy to memorize all the code. Here is the cheatsheet.

Example Account Name: Assets:US:Chase:Checking

Account Types

  • Assets +

  • Liabilities -

  • Income -

  • Expenses +

  • Equity -

Commodities

All in CAPS:

USD, EUR, CAD, AUD,GOOG, AAPL, RBF1005,HOME_MAYST, AIRMILES,HOURS

Directives

General syntax:

YYYY-MM-DD <arguments…>

Opening & Closing Accounts

2001-05-29 open Expenses:Restaurant

2001-05-29 open Assets:Checking USD,EUR *; Currency constraints*

2015-04-23 close Assets:Checking

Declaring Commodities

This is optional; use this only if you want to attach metadata by currency.

1998-07-22 commodity AAPL
name: “Apple Computer Inc.”

Prices

Use many times to fill historical price database:

2015-04-30 price AAPL 125.15 USD

2015-05-30 price AAPL 130.28 USD

Notes

2013-03-20 note Assets:Checking “Called to ask about rebate”

Documents

2013-03-20 document Assets:Checking “path/to/statement.pdf”

Transactions

2015-05-30 * “Some narration about this transaction”
Liabilities:CreditCard -101.23 USD
Expenses:Restaurant 101.23 USD

2015-05-30 ! “Cable Co” “Phone Bill” #tag ˆlink

id: “TW378743437” *; Meta-data*
Expenses:Home:Phone 87.45 USD
Assets:Checking *; You may leave one amount out*

Postings

... 123.45 USD                 *Simple*
... 10 GOOG {502.12 USD}       *With per-unit cost*
... 10 GOOG {{5021.20 USD}}    *With total cost*

... 10 GOOG {502.12 # 9.95 USD} *With both costs*
... 1000.00 USD  @ 1.10 CAD     *With per-unit price*
... 10 GOOG {502.12 USD} @ 1.10 CAD       *With cost & price*
... 10 GOOG {502.12 USD, 2014-05-12 }     *With date*
!... 123.45 USD ...                       *With flag*

Balance Assertions and Padding

Asserts the amount for only the given currency:

2015-06-01 balance Liabilities:CreditCard -634.30 USD

Automatic insertion of transaction to fulfill the following assertion:

YYYY-MM-DD pad Assets:Checking Equity:Opening-Balances

Events

YYYY-MM-DD event “location” “New York, USA”
YYYY-MM-DD event “address” “123 May Street”

Options

option “title” “My Personal Ledger”

Other

pushtag #trip-to-peru
…
poptag #trip-to-peru
; Comments begin with a semi-colon