# Syntax Quick Reference for the Ledger-Likes
[Big 3](index.html)
| [Ledger](quickref-ledger.html)
| [hledger](quickref-hledger.html)
| [Beancount](quickref-beancount.html)
The journal file formats of Ledger, hledger and Beancount, in brief. Last tested: 2016.
See also:
[original google sheet](https://docs.google.com/document/d/1L5OyRZ4nxQVjZJugyEyYi_H-229yaWV-yx0raAO1iog),
[plaintextaccounting.org](https://plaintextaccounting.org).
Contents:
- [Journal Format](#journal-format)
- [Basic example](#h.8v2r9qqwt9f8)
- [Comments](#h.1n05blr44u7c)
- [Basic transactions](#h.gij3l494xeth)
- [Dates](#h.xpr0dgy4pyj3)
- [Account names](#h.n4b87oz9ku6t)
- [Amounts](#h.n4b87oz9ku6t)
- [More transaction features](#h.9xaw86fvi6s6)
- [Prices](#h.d2g5xagy7h37)
- [Balance assertions](#h.mjrjnr996vfg)
- [Balance assignments](#h.mjrjnr996vfg)
- [Directives](#h.au5ysr0kfa)
- [account, open](#h.3v5cafffbbft)
- [close](#h.22qss13648tb)
- [commodity](#h.n9q16dsjsoye)
- [market price](#h.wya8r85tgqsx)
## Journal format
Things in square brackets are optional. Some notes in the Ledger column are common to all.
|
|
Ledger |
Beancount
|
|
Basic example |
; a comment |
; a comment |
; a comment |
Comments |
; comment |
; comment |
; comment |
Basic transactions |
DATE [DESCRIPTION] |
DATE [[PAYEE | ]NOTE]
|
DATE txn [["PAYEE"] "DESCRIPTION"] |
Dates |
YYYY-MM-DD |
YYYY-MM-DD |
YYYY-MM-DD |
Account names |
TOPACCT[:SUBACCT[:...]] |
TOPACCT[:SUBACCT[:...]] |
TOPACCT[:SUBACCT[:...]] |
Amounts |
One of
|
One of
|
QUANTITY COMMODITY |
More transaction features |
DATE [FLAG] [(CODE)] DESCRIPTION |
DATE [FLAG] [(CODE)] DESCRIPTION |
DATE [txn|FLAG] [["PAYEE"] "DESCRIPTION"] |
Prices |
One of |
One of |
{LOTUNITPRICE[ / LOTDATE]} |
Balance assertions |
= AMOUNT (after posting amount & price) |
= AMOUNT (after posting amount & price) |
DATE balance ACCOUNT AMOUNT |
Balance assignments |
= AMOUNT (no preceding/inferred posting amount)
|
|
|
Directives |
KEYWORD ARGS...
alias
payee |
KEYWORD ARGS... |
[DATE] KEYWORD ARGS... |
account, open |
account ACCOUNT
[SUBDIRECTIVES] |
|
DATE open ACCOUNT [COMMODITY[,...]] [METHOD] |
close |
|
|
DATE close ACCOUNT |
commodity |
commodity COMMODITY |
|
DATE commodity COMMODITY |
market price |
P DATE TIME COMMODITY UNITPRICE
|
P DATE [TIME] COMMODITY UNITPRICE |
DATE price COMMODITY AMOUNT |