hledger
Basic setup of hledger for personal finance.
Motivation
The configuration and use of ledger presents simplicity, speed, and notable monitoring.
In particular, the implementation hledger offers a wide range of compatible programs, such as reporting and web interface.
Structure
We use the file ~/.hledger.journal to
redirect hledger to the main file in the folder designated for
finances, accounts/.
; File ~/.hledger.journal
include ~/accounts/main.ledger
We use 2 configuration files and a book/
folder for transactions.
accounts/
├── book/
│ └── 2000/
│ └── 01.ledger
├── header.ledger
└── main.ledger
Configuration
- main
- Lists the ledger files to be used and configure the year.
- header
- Define the accounts and currencies.
; File main.ledger
include header.ledger
; Transactions
Y2000
include book/2000/*.ledger
;Y2001
;include book/2001/*.ledger
; File header.ledger
;==============================================================================
; Assets
;==============================================================================
account assets:bank
account assets:cash
;==============================================================================
; Liabilities
;==============================================================================
account debts:target
;==============================================================================
; Income
;==============================================================================
account income:work
;==============================================================================
; Expenses
;==============================================================================
account expenses:transports
account expenses:food
account expenses:rent
Account types.
- Assets
- Available resources such as bank and/or cash accounts.
- Liabilities
- Debts and/or obligations.
- Income
- Revenue, salary and others incomes.
- Expenses
- Expenses, costs, shopping and other output money.
- Equity
- The real value of properties, such as stocks, furniture, or real estate. It is also used for opening and closing balances.
Transactions
We classify them by folders for years and files
(01.ledger) for months. Additionally, an
initial balance file is required to indicate the initial available money.
; File book/2001/inicial.ledger
include header.ledger
01/01 * 'opening balance'
assets:banco 1000.00 USD
assets:cash 100.00 USD
equity:opening
Transactions use the zero-sum principle. Preferably, the account(s) to be debited/the destination are declared first, and finally the sources. If the source is singular, the destination accounts are automatically summed; otherwise, it is necessary to declare the amounts individually.
Also necessary to declare the transaction status.
| Symbol | Status | Description |
|---|---|---|
| ' ' | No status. | Registered but not reconciled. |
| '!' | Pending | Reconciliation attempt. |
| '*' | Reconciled | Completed, transaction correct. |
; File book/2001/01.ledger
01/02 ! 'rent'
expenses:rent 300.00 USD
assets:bank
01/03 * 'lunch'
expenses:food 30.00 USD
assets:cash
01/03 'bus'
expenses:transports 5.00 USD
assets:cash
Reports
Basic balance.
$ hledger bs
Balance Sheet 2000-01-03
|| 2000-01-03
==============++============
Assets ||
--------------++------------
assets:bank || 700.00 USD
assets:cash || 65.00 USD
--------------++------------
|| 765.00 USD
==============++============
Liabilities ||
--------------++------------
--------------++------------
|| 0
==============++============
Net: || 765.00 USD
Monthly balance.
$ hledger bs -M -V
Monthly Balance Sheet 2000-01-31, valued at period ends
|| 2000-01-31
==============++============
Assets ||
--------------++------------
assets:bank || 700.00 USD
assets:cash || 65.00 USD
--------------++------------
|| 765.00 USD
==============++============
Liabilities ||
--------------++------------
--------------++------------
|| 0
==============++============
Net: || 765.00 USD
Income and expense report.
$ hledger is
Income Statement 2000-01-01..2000-01-03
|| 2000-01-01..2000-01-03
=====================++========================
Revenues ||
---------------------++------------------------
---------------------++------------------------
|| 0
=====================++========================
Expenses ||
---------------------++------------------------
expenses:transports || 5.00 USD
expenses:food || 30.00 USD
expenses:rent || 300.00 USD
---------------------++------------------------
|| 335.00 USD
=====================++========================
Net: || -335.00 USD
Monthly income and expense report.
$ hledger is -M -S
Monthly Income Statement 2000-01
|| Jan
=====================++=============
Revenues ||
---------------------++-------------
---------------------++-------------
|| 0
=====================++=============
Expenses ||
---------------------++-------------
expenses:rent || 300.00 USD
expenses:food || 30.00 USD
expenses:transports || 5.00 USD
---------------------++-------------
|| 335.00 USD
=====================++=============
Net: || -335.00 USD