Transactions are the most common type of directives that occur in a ledger. Costflow Syntax support two methods for transactions.
The first one uses greater-than sign, it means the flow direction from its left to its right. The general format is:
The elements in square brackets are optional. Here are some examples.
The date is optional. If no YYYY-MM-DD format date found, the date will be 'today' in your timezone;
The flag is used to indicate the status of a transaction, means completed transaction, ! means incomplete transaction. can be omitted;
Payees and narration are easy to use, but the syntax is a little bit complex:
- Compatible with Beancount double quotes format: if there is only one double-quotes string, it is a narration; If there are two double-quotes strings, the first one is a payee and the second one is narration.
- Double-quotes can be omitted in these cases:
- Input narration directly without double-quotes, but the narration cannot contain numbers. E.g., 'Xbox 360 Game' is not a valid narration.
- Payee can be used in @Payee format. In this rule, payee cannot contain blank spaces, but payee can be connected with - or _. E.g., @KFC and @Burger_King are all valid payees.
- If you only want to record payee, just input @Payee, no need to concern narration.
Tag: strings start with
#are treated as tags;
Link: strings start with ^ are treated as links;
In the first transaction syntax:
- AMOUNT. Because > means the flow direction, so the default amounts in left side are negative, the minus sign can be omitted;
- COMMODITY. Optional, the default value is what you set before;
- ACCOUNT. Accounts can be the full name in your ledger file, or they can be the abbreviations you set before.
The right side rules are the same with the left side, except the default amounts are positive;
Costs and prices are not support in this version.
If there are multiple accounts in either side, use
+to connect, Be aware, only one
>allowed in a message;
The amounts in the right side can be omitted, they are equal to sum*(left side amounts)/(right side accounts number). Useful when splitting expenses with friends.
The second method uses the pipe sign (U+007C) instead of
>, it means "start a new line", the timing is the same with Beancount. The syntax detail:
As we can see, the usage of Date, Flag, Payee, Narration, Tag, Link are all same with the first one. The differences:
- Should insert a
|between each account;
- The second transaction syntax has no flow direction, so the minus sign and amounts cannot be omitted;
We can rewrite the examples with |: