Excerpts from https://www.reddit.com/r/plaintextaccounting/comments/1h6ksok/a_report_to_explain_a_net_worth_change_in_ledger:
Chary_314: I would want to be able to get a report, which explains why
between 1 Jan 2020 and 1 Jan 2021 Net Worth [including unrealised gains]
has change from 100kUSD to 120kUSD2020-01-01 open Assets:House 2020-01-01 open Equity:Opening-Balances 2020-01-01 * "Opening balances" Assets:House 1 HOUSE Equity:Opening-Balances 2020-01-01 price HOUSE 100000 USD 2021-01-01 price HOUSE 120000 USD ;<== one year later
SM: Nice. Actually I struggled to do it with hledger. But Ledger can do it easily; by default it generates revaluation transactions showing unrealised gains:
Show the changes from inflows/outflows and from price fluctuations:
$ ledger reg house -V 20-Jan-01 "Opening balances" Assets:House USD100000 USD100000 21-Jan-01 Commodities revalued <Revalued> USD20000 USD120000
Show just the changes from price fluctuations:
$ ledger reg house -V --revalued-only 21-Jan-01 Commodities revalued <Revalued> USD20000 USD120000
There's also a --revalued-total option which I didn't figure out, needs docs.
SM: With current hledger, this is the best I found.
I had to add an explicit @@ COST to the house purchase, since thebal --gain
report requires it.
(You could automate that withhledger print --infer-market-prices | hledger -f- -I ...
)Show the changes from inflows/outflows (valued at the end of each period):
You could increase the frequency to daily if needed.$ hledger bal -QNV --transpose house date:2020..2021/2 Balance changes in 2020-01-01..2021-03-31, valued at period ends: || Assets:House ========++============== 2020Q1 || 100000 USD 2020Q2 || 0 2020Q3 || 0 2020Q4 || 0 2021Q1 || 0
Show the changes from price fluctuations:
$ hledger bal -QNV --transpose house date:2020..2021/2 --gain Incremental gain in 2020-01-01..2021-03-31, valued at period ends: || Assets:House ========++============== 2020Q1 || 0 2020Q2 || 0 2020Q3 || 0 2020Q4 || 0 2021Q1 || 20000 USD