Below is a short reference of the Beancount language syntax. Also see the full Syntax Documentation and the Syntax Cheat Sheet.
Beancount defines a language in which financial transactions are entered into a text-file, which then can be processed by Beancount. There are a few building blocks that are important to understand Beancount's syntax:
All in CAPS:
Account are given by a colon-separated list of capitalized words. They must
begin with one of the five root accounts listed in the table below. The
separation by colons defines an implicit hierarchy, for example we say that
Assets:Cash is a sub-account of
||+||Cash, Checking-Account, etc.||
||-||Credit Card, etc.||
||-||Almost always auto-generated||
The names of the five root accounts can be changed with the following options:
The basic building block are directives (also called entries). Most directives start with a date, then the type of the directive, and then directive-specific arguments. The ordering of directives in the input-file does not matter, because Beancount orders them based on the date of each directive.
YYYY-MM-DD <directive> <arguments...>
Open and Close accounts
To open or close an account use the
Declaring commodities is optional. Use this if you want to attach metadata by
currency. If you specify a
name for a currency like below, this name will be
displayed as a tooltip on hovering over currency names in Fava. Likewise, with
precision metadata, you can specify the number of decimal digits to show
in Fava, overriding the precision that is otherwise automatically inferred from
the input data.
You can use this directive to fill the historical price database:
Balance Assertions and Padding
Asserts the amount for only the given currency:
Automatic insertion of transaction to fulfill the following assertion:
See the Beancount Options Reference for the full list of supported options.