Ledger

From wikinotes

ledger is a commandline accounting program. It has become very popular, and has implementations in several languages.

Install

sudo pacman -S ledger                           # official ledger
sudo pacman -S hledger hledger-ui hledger-web   # ledger rewritten in haskell



Usage

hledger bal -M                                    # show balance of all non-zero accounts

hledger bal -M --budget   --cumulative            # show budgeted-money VS spent-money. 
                                                  # --cumulative carries unspent money into next month

hledger bal -M --forecast --cumulative            # project account totals in a 6 month range

hledger bal -M --forecast --budget --cumulative   # projected budget amounts in a 6 month range


hledger bal -M --forecast   will                  # show only account 'will' and sub-accounts



Syntax

Each transaction starts with a date. Transactions can involve any number of accounts, but in order to be valid, the sum of all debits/deposits must work out to 0.

Transactions

; comment

2018/03/11  date of entry(ies)
   ; account                 ; debit/credit
   acct:                           0
   acct:sub_acct                   0
   acct:sub_acct:sub_subacct       0
http://hledger.org/journal.html journal syntax

Pending Transactions

Transactions can be marked as

  • <date> * cleared transaction (paid)
  • <<date> ! uncleared transaction (unpaid)
2016-10-13 ! Mr. Slow-To-Repay         ; record an IOU. Counts towards total assets, but tracked as not paid.
  Assets:Reimbursement  $20.00
  Liabilities:Credit Card

2016-10-21  Mr. Slow-To-Repay Payment  ; transfer from IOU to a real account.
  Assets:SomeBank:Chequing  $20.00
  Assets:Reimbursement

Transaction Tags

Transactions can be tagged, either with text, or a key/value pair. Both can be queried.

  • ; key: value
  • ; :keyword:
2017-04-01 A Run-Down Tin Shack
  Expenses:Hotels     $20.00
  ; Event: PyCon-2017

2017-04-02 Bob's Used Cars
  Expenses:Car        $10,000.00
  ; :OneOff:

Budgets

~ monthly from 2008/01   ; See  http://hledger.org/manual.html#period-expressions
    will:account
    will:budgets:maintenance:auto  100$

Scheduled Transactions

NOTE:

Scheduled transactions are only available in the emacs module

https://www.ledger-cli.org/3.0/doc/ledger-mode.html#Scheduling-Transactions

[2018,2019/*/1]  Rent
    shared:expenses:residential   $1200
    shared:debts

Shared Expenses

See: https://mumble.net/~campbell/2017/02/26/ledger/HOWTO-sharedexpense



Reference

https://www.ledger-cli.org/3.0/doc/ledger3.html
http://hledger.org/journal.html
http://hledger.org/hledger.html
http://hledger.org/hledger-ui.html
https://www.linux.com/news/ledger-bran-muffin-accounting-tools
https://felixcrux.com/blog/ledger-practices