ledger
and gave it a tryCash in Wallet | Food expenses | ||
Amount | Balance | Amount | Balance |
-750 JPY | 2,307 JPY | 750 JPY | 43,108 JPY |
-120 JPY | 2,187 JPY | 120 JPY | 43,228 JPY |
Salary | Bank account | ||
Amount | Balance | Amount | Balance |
-12,345 JPY | -246,789 JPY | 12,345 JPY | 14,679 JPY |
ledger
ledger
on that file for reporting.ledger
checks that everything balances and computes the numbers
for the report.ledger
is not a tool to enter transactions!General format:
date payee ; note account 1 amount account 2 amount
For example:
2016-02-25 Lawson ; Ham Sandwich Expenses:Food 325 JPY Assets:Cash -325 JPY
ledger
also allows:
2016-02-25 Lawson Expenses:Food 325 JPY Assets:Cash
2016-02-25 Lawson Expenses:Food 301 JPY Expenses:Taxes 24 JPY Assets:Cash -325 JPY
ledger
can compute the balance on each account.
Input file:
2016-02-20 Company Assets:Bank 123,456 JPY Income:Salary 2016-02-22 Bank Assets:Cash 20,000 JPY Assets:Bank 2016-02-26 Landlord Expenses:Rent 70,000 JPY Assets:Bank 2016-02-27 Supermarket Expenses:Food 2,017 JPY Assets:Cash
$ ledger balance
51,439 JPY Assets 33,456 JPY Bank 17,983 JPY Cash 72,017 JPY Expenses 2,017 JPY Food 70,000 JPY Rent -123,456 JPY Income:Salary -------------------- 0
(The input file name is passed with -f
or the LEDGER_FILE
environment variable.)
ledger
can display all transaction for an account with a running total.
$ ledger register Cash
16-Feb-22 Bank Assets:Cash 20,000 JPY 20,000 JPY 16-Feb-25 Lawson Assets:Cash -325 JPY 19,675 JPY 16-Feb-27 Supermarket Assets:Cash -2,017 JPY 17,658 JPY 16-Mar-01 Lawson Assets:Cash -288 JPY 17,370 JPY
$ ledger --period "feb 2016" register Food
16-Feb-25 Lawson Expenses:Food 325 JPY 325 JPY 16-Feb-27 Supermarket Expenses:Food 2,017 JPY 2,342 JPY
equity
: collapse all transactions into a single onexml
, csv
: list transactions in other formatsxact
: create a new transaction from a pattern--period
, --begin
, --end
: date limit--strict
: check that all used entities existOne possible solution: Pay as much as possible using credit card, and treat cash as “Expense”, not “Asset”.
2016-03-02 ATM Expenses:Cash 10,000 JPY Assets:Bank
To track an “important” expense, move money from Expenses:Cash to the target account:
2016-03-05 Expensive Restaurant Expenses:Eat Out 8,000 JPY Expenses:Cash
For checks, balance assertions can be used.
2016-03-05 Check balance ; ledger run will fail if we don't have 123 JPY Assets:Cash = 123 JPY
To correct the amount, balance resets can be used.
2016-03-06 Correct balance ; take from Expenses:Loss what is required to get to 123 JPY Assets:Cash = 123 JPY Expenses:Loss
2016-02-15 Amazon Expenses:Books 780 JPY Liabilities:Credit Card
$ ledger balance
780 JPY Expenses:Books -780 JPY Liabilities:Credit Card --------- 0
2016-02-15 Amazon Expenses:Books 780 JPY Liabilities:Credit Card 2016-03-27 Pay Invoice Liabilities:Credit Card 780 JPY Assets:Bank
$ ledger balance
-780 JPY Assets:Bank 780 JPY Expenses:Books --------- 0
2016-02-17 Taxi ; no bus in inaka Liabilities:PFN 3,020 JPY Assets:Cash
$ ledger balance
-3,020 JPY Assets:Cash 3,020 JPY Liabilities:PFN ------------- 0
2016-02-17 Taxi Liabilities:PFN 3,020 JPY Assets:Cash 2016-03-20 PFN Assets:Bank 126,476 JPY Liabilities:PFN -3,020 JPY Income:Salary -123,456 JPY
$ ledger balance
123,456 JPY Assets 126,476 JPY Bank -3,020 JPY Cash -123,456 JPY Income:Salary ------------- 0
ledger
:
2016-02-29 Shopping day Fridge Supermarket -2 Apples Konbini -3 Beers
$ ledger balance fridge
2 Apples 3 Beers Fridge
2016-02-29 ATM @ Europe Assets:Cash 50 EUR Assets:Bank -6,258 JPY
$ ledger prices
2016/02/29 EUR 125.16 JPY
2016-02-29 ATM @ Europe Assets:Cash 50 EUR @ 125 JPY Assets:Bank
$ ledger balance -X JPY Bank
JPY-6250 Assets:Bank
2015-05-04 Buy Stock Assets:Brokerage 10 BMW Assets:Bank -1,067.50 EUR 2015-09-24 Buy Stock Assets:Brokerage 15 BMW Assets:Bank -1,135.20 EUR
$ ledger balance brokerage
25 BMW Assets:Brokerage
$ cat prices.db
P 2015/05/04 BMW 106.75 EUR P 2015/09/24 BMW 75.68 EUR P 2016/03/04 BMW 82.63 EUR
$ ledger --market --price-db prices.db balance brokerage
2,065.75 EUR Assets:Brokerage
$ ledger --gain --price-db prices.db balance brokerage
-136.95 EUR Assets:Brokerage
ledger
allows to attach metadata to transactions, such as
effective dates, IDs, clearing state, and tags.
2016-02-15=2016-03-27 ! (123-7654) Rakuten Expenses:Books 780 JPY ; payee: HappyBooks 123 Expenses:Household 2,350 JPY ; payee: MyHousehold Liabilities:Credit Card ; :OnlineShopping:Manga: ; ShippingMethod: deliver to home address ; ShipmentDate:: [2016-02-16]
$ ledger --effective balance
$ ledger --pending|--cleared register
$ ledger register tag manga
$ ledger register tag ShipmentDate < [2016-02-20]
Set up a budget and compare it against real expenses.
~ Monthly Expenses:Eat Out 10,000 JPY Assets:Cash 2016-02-14 Izakaya Expenses:Eat Out 3,723 JPY Assets:Cash 2016-02-28 Medium Restaurant Expenses:Eat Out 5,182 JPY Assets:Cash 2016-03-04 Expensive Restaurant Expenses:Eat Out 12,300 JPY Assets:Cash
$ ledger --monthly --budget register Expenses
16-Feb-01 - 16-Feb-29 Expenses:Eat Out -1,095 JPY -1,095 JPY 16-Mar-01 - 16-Mar-31 Expenses:Eat Out 2,300 JPY 1,205 JPY
Set up a budget and forecast your financial situation.
~ Monthly Expenses:Eat Out 10,000 JPY Expenses:Food 15,000 JPY Expenses:Rent 70,000 JPY Income:Salary -123,456 JPY Assets
$ ledger --monthly --forecast "d < [2016-09]" register Assets
16-Apr-01 - 16-Apr-30 Assets 28,456 JPY 28,456 JPY 16-May-01 - 16-May-31 Assets 28,456 JPY 56,912 JPY 16-Jun-01 - 16-Jun-30 Assets 28,456 JPY 85,368 JPY 16-Jul-01 - 16-Jul-31 Assets 28,456 JPY 113,824 JPY 16-Aug-01 - 16-Aug-31 Assets 28,456 JPY 142,280 JPY
ledger
Ecosystemledger-mode
provides syntax highlighting, tab completion,
integrated reports etc.
ledger
helps you track your money, stock, and (optionally) apples.ledger
files.