From 18623ec287c0a26eb844422dba4c1012b7f3f328 Mon Sep 17 00:00:00 2001 From: Dmitry Astapov Date: Thu, 25 Feb 2021 23:02:38 +0000 Subject: [PATCH] doc: explain roi-unrealised.ledger, reference to cookbook --- examples/roi-unrealised.ledger | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/examples/roi-unrealised.ledger b/examples/roi-unrealised.ledger index 340049e7d..47d1a5ea9 100644 --- a/examples/roi-unrealised.ledger +++ b/examples/roi-unrealised.ledger @@ -1,6 +1,34 @@ ; Example from hledger mail list. -; roi usually shows rate of return based on realised gains. -; By adding some fake transactions you can make it show unrealised gains. +; author of the mailing list post wrote: "roi usually shows rate of return based on realised gains. +; By adding some fake transactions you can make it show unrealised gains." +; +; Note that you can record dividends with a three-posting transaction, which will yield simpler account structure: +; +; 2014-12-31 Initial Deposit +; Equity:Opening -722.40 +; Assets:Cash +; +; 2014-12-31 Buy Royal Bank of Canada @ 71.74 +; Assets:Trading:RY 10 RY @ 71.74 +; Assets:Cash -722.40 +; Expenses:Fees 5.00 +; +; 2015-01-22 0.75 Dividend +; Assets:Cash 7.50 +; Assets:Trading:RY 0 +; Income:Dividend:RY +; +; 2015-04-21 0.77 Dividend +; Assets:Trading:Cash 7.70 +; Assets:Trading:RY 0 +; Income:Dividend:RY +; +; and so on. And then ROI could be computed thusly: +; +; hledger -f examples/roi-unrealised.ledger roi --inv Assets:Trading:RY -b 2015-01-01 -e 2019-01-01 --pnl Income --yearly --value=then +; +; See Cookbook -> (Return on Investment) for more info. + comment $ hledger -f examples/roi-unrealised.ledger roi --inv Assets -b 2015-01-01 -e 2019-01-01 --pnl Income --yearly --value=then