You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
362 lines
7.2 KiB
362 lines
7.2 KiB
3 years ago
|
---
|
||
|
|
||
|
Alias: ["Personal Accounting"]
|
||
|
Tag: ["Admin", "Finances", "Computer", "IT", "App"]
|
||
|
Date: 2021-08-19
|
||
|
DocType: "Confidential"
|
||
|
Hierarchy: "Root2"
|
||
|
TimeStamp: 2021-08-19
|
||
|
location: [51.514678599999996, -0.18378583926867909]
|
||
|
CollapseMetaTable: Yes
|
||
|
|
||
|
---
|
||
|
|
||
|
Parent:: [[Finances]]
|
||
|
|
||
|
---
|
||
|
|
||
|
 
|
||
|
|
||
|
```button
|
||
|
name Save
|
||
|
type command
|
||
|
action Save current file
|
||
|
id Save
|
||
|
```
|
||
|
^button-hLedgerSave
|
||
|
|
||
|
 
|
||
|
|
||
|
# hLedger
|
||
|
|
||
|
 
|
||
|
|
||
|
```ad-abstract
|
||
|
title: Summary
|
||
|
collapse: open
|
||
|
This note describes the workings of plain text accounting through hLedger
|
||
|
```
|
||
|
|
||
|
 
|
||
|
|
||
|
```toc
|
||
|
style: number
|
||
|
```
|
||
|
|
||
|
 
|
||
|
|
||
|
---
|
||
|
|
||
|
 
|
||
|
|
||
|
### Documentation
|
||
|
|
||
|
 
|
||
|
|
||
|
[Plain text Accounting](https://plaintextaccounting.org/)
|
||
|
|
||
|
[hledger](https://hledger.org/create-a-journal.html)
|
||
|
|
||
|
[Ledger manual](https://www.ledger-cli.org/3.0/doc/ledger3.html#index-account_002c-alias)
|
||
|
|
||
|
[Ledger helpers](https://github.com/ledger/ledger/wiki/Entering-transactions-with-ledgerhelpers-GUI-apps)
|
||
|
|
||
|
[Ledger help](https://github.com/ledger/ledger/wiki/Entering-data)
|
||
|
|
||
|
 
|
||
|
|
||
|
---
|
||
|
|
||
|
 
|
||
|
|
||
|
### hLedger
|
||
|
|
||
|
 
|
||
|
|
||
|
Plain Text Accounting is accessible through command-line clients like hledger.
|
||
|
Installation is simple:
|
||
|
|
||
3 years ago
|
|
||
|
```ad-command
|
||
|
~~~
|
||
3 years ago
|
brew install hledger
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
Some extensions may be required for certain functionalities to work and will be documented accordingly.
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Structure
|
||
|
|
||
|
The structure of the tool and resulting file is rather simple. The tool offers two main functionalities:
|
||
|
|
||
|
1. **Import data**
|
||
|
hLedger allows for direct links to your bank or manual entries into the ledger.
|
||
|
|
||
|
2. **Reports on aggregated data**
|
||
|
A suite of reports is available to visualise financial data
|
||
|
|
||
|
The underlying database is a (collection of) file(s) readable through classic text editors with a list of the transactions made during the period.
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Initialisation
|
||
|
At start of the year/period in any given file, a certain number of initialisations need to be made:
|
||
|
|
||
|
1. **Initialise top-level accounts**
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
account 'name of account'
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
2. **Currencies used**
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
commodity 'layout + number format'
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
2. **Opening balances**
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
'Date' set initial 'account name' account balance
|
||
|
'account name'(+optional nesting -> :'sub-account') {+ 2 spaces min} 'amount'
|
||
|
equity:opening balances
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Transactions
|
||
|
|
||
|
hLedger allows for three methods for entering transactions:
|
||
|
|
||
|
1. **Through command-line**
|
||
|
|
||
|
This method is well-guided with hLedger:
|
||
|
|
||
3 years ago
|
|
||
|
```ad-command
|
||
|
~~~
|
||
3 years ago
|
hledger add -f 'journalname'
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
3 years ago
|
|
||
3 years ago
|
The function will then prompt the user for appropriate entries.
|
||
|
|
||
|
2. **Manually into the .journal file**
|
||
|
|
||
|
Open the .journal file and manually enter transactions with the following format:
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
(date) 'transaction name'
|
||
|
'account 1' {2+ spaces} (amount)
|
||
|
'account 2' {2+ spaces} !(amount)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
3. **Import**
|
||
|
|
||
3 years ago
|
```ad-command
|
||
3 years ago
|
title: Import from Note
|
||
|
~~~
|
||
|
hledger import -f 'journalname' 'filename'
|
||
|
~~~
|
||
|
```
|
||
|
|
||
|
```ad-note
|
||
|
title: CSV Import
|
||
|
hLedger requires a certain level of customisation to import .csv.
|
||
|
Instructions can be found [here](https://hledger.org/import-csv.html)
|
||
|
```
|
||
|
|
||
|
4. **Recurring transactions**
|
||
|
|
||
|
[Recurring transactions](https://hledger.org/hledger.html#periodic-transactions) are declared as below:
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
~ monthly (or other periodicity) (optional 'from')
|
||
|
(account 1):(sub-account 1) {2+ spaces} (amount)
|
||
|
(account 2):(sub-account 2)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Investments
|
||
|
|
||
|
```ad-info
|
||
|
title: Documentation
|
||
|
The documentation can be found [here](https://hledger.org/investments.html)
|
||
|
```
|
||
|
|
||
|
1. **Adding an Investment**
|
||
|
|
||
|
Using a strict and clear nomenclature, an initial investment is inputed manually using the following block:
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
(Investment date)
|
||
|
Investment:(sub-account):(asset-account) (units) (internal stock mnemonic)
|
||
|
equity:conversion -(units) (internal mnemonic)
|
||
|
equity:conversion (monetary amount)
|
||
|
funding account -(monetary amount)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
2. **Price file**
|
||
|
|
||
|
A price file can be created separately to manage asset prices and actual transactions in separate docs. To this effect, both files are required to be in the same folder and the main journal carries the following command:
|
||
|
|
||
3 years ago
|
|
||
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
include (filename).prices
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
Prices are inputed as follows:
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
P (date) (asset1) (asset2)(conversion value)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
3. **Re-pricing Investment**
|
||
|
|
||
|
Re-pricing happens through the price file by simply adding a 'P' command with a new date in the .prices file.
|
||
|
|
||
|
4. **Selling an investment**
|
||
|
|
||
|
To respect the coherence of the Accounting Equation, sales will follow the same nomenclature as purchases, with an explicit declaration of realised p&l:
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
(Investment date)
|
||
|
Investment:(sub-account):(asset-account) -(units) (internal stock mnemonic)
|
||
|
equity:conversion (units) (internal mnemonic)
|
||
|
equity:conversion -(monetary amount @ purchase)
|
||
|
revenues:capital gain -(p&l)
|
||
|
receiving account (monetary amount)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
This flexibility enables to implement FIFO/LIFO as per prevailing fiscal rules.
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Closing books
|
||
|
|
||
|
In order to close books, revenues/expenses need to amount to 0 and only show Asset, Liability and Equity. The below is a growing mapping of revenues and expenses lines:
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
(Closing date)
|
||
|
revenues:Salary (outstanding balance) = 0
|
||
|
revenues:investment income (outstanding balance) = 0
|
||
|
revenues:capital gains (outstanding balance) = 0
|
||
|
equity:retained earnings -(resulting amount)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
3 years ago
|
```ad-code
|
||
|
~~~
|
||
3 years ago
|
(Closing date)
|
||
|
expenses (outstanding balance) = 0
|
||
|
equity:running costs -(resulting amount)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Reports
|
||
|
|
||
|
```ad-info
|
||
|
title: Documentation
|
||
|
Simple reports can be found [here](https://hledger.org/quickstart.html#run-reports)
|
||
|
```
|
||
|
|
||
|
**Income statement report**
|
||
|
|
||
3 years ago
|
|
||
|
```ad-command
|
||
|
~~~
|
||
3 years ago
|
hledger -f 'filename' is -Y (period argument) -3 (depth argument) -S (sorting by amount argument) -o (output file argument)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
3 years ago
|
|
||
3 years ago
|
**Balance sheet report**
|
||
|
|
||
3 years ago
|
```ad-command
|
||
|
~~~
|
||
3 years ago
|
hledger -f 'filename' bs -Y (period argument) -V (optional price basis: end of year each year, local ccy; --value=end,(ccy) for forcing GBP/EUR) (optional --infer-value) -o (output file argument)
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
3 years ago
|
|
||
3 years ago
|
'bs' can be replaced by 'bse' to show the Equity block.
|
||
|
|
||
|
**ROI report**
|
||
|
|
||
3 years ago
|
```ad-command
|
||
|
~~~
|
||
3 years ago
|
hledger -f 'filename' roi --investment (investment account) -Y (period argument) --value=then,"(ccy)" --infer-market-price --pnl "unrealized"
|
||
3 years ago
|
~~~
|
||
3 years ago
|
```
|
||
|
|
||
|
**Arguments**
|
||
|
|
||
|
`--no-elide`: explicitly print all values
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Tools
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Useful commands
|
||
|
|
||
|
1. <mark class="green">stats</mark>: account stats (number of transactions, ccy, exchange rates, etc...)
|
||
|
2. <mark class="green">print</mark>: transaction history
|
||
|
3. <mark class="green">aregister</mark>: transaction history in a particular account
|
||
|
4. <mark class="green">cashflow</mark>: summary of cashflows per asset account & ccy
|
||
|
5. <mark class="green">balance</mark>: show account balances
|
||
|
|
||
|
 
|
||
|
|
||
|
#### Other commands
|
||
|
|
||
|
```ad-example
|
||
|
title: Specific tasks
|
||
|
[Error checking](https://hledger.org/checking-for-errors.html)
|
||
|
```
|
||
|
|
||
|
 
|
||
|
|
||
|
### Tasks & Further steps
|
||
|
|
||
|
 
|
||
|
|
||
|
```ad-question
|
||
|
title: To explore
|
||
|
- [!] Tax
|
||
|
- [!] Financial forecasting
|
||
|
```
|
||
|
|
||
|
- [ ] Tax for Investments
|
||
|
- [ ] Financial forecasting
|
||
3 years ago
|
- [ ] Update Price file 🔁 every 3 months on the 1st Friday 📅 2021-10-03
|
||
|
- [x] Update Price file 🔁 every 3 months on the 1st Friday ✅ 2021-10-02
|
||
3 years ago
|
|
||
|
 
|
||
|
 
|