3 ms·
The file format for ledger is very simple, it's literally just a list of transations formatted like this: 2021/01/12 Grocery store Assets:Checking
by OskarS 6y ago
The file format for ledger is very simple, it's literally just a list of transations formatted like this:
2021/01/12 Grocery store
Assets:Checking
Expenses:Groceries $50
This transaction means that you spent $50 at the grocery store. It's double-entry bookkeeping, so the transfers always balance: "Assets:Checking" account is reduced by $50 and "Expenses:Groceries" is increased by $50. This entry is equivalent to the previous one.
2021/01/12 Grocery store
Assets:Checking -$50
Expenses:Groceries $50
But this entry is invalid, since it's not balanced (it's the accounting equivalent of a compiler error, and ledger will throw an error when parsing this):
2021/01/12 Grocery store
Assets:Checking -$75
Expenses:Groceries $50
A ledger file is literally just a list of these transactions. Accounts are created the first time you use them in a transaction. Transactions can have more than two associated accounts, but they still have to balance. There are many more advanced features, but this (along with some basic understanding of accounting) is all you really need.