--You received this message because you are subscribed to the Google Groups "hledger" group.To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.To view this discussion visit https://groups.google.com/d/msgid/hledger/87cf6d22-dde0-40fa-9b2b-f802c6678671n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hledger/8b17bcfa-134f-49aa-9ecd-54791c37b063%40app.fastmail.com.
To view this discussion visit https://groups.google.com/d/msgid/hledger/600df205-0342-4f0f-999e-d8d79c46d12a%40app.fastmail.com.
3. How to get roi/xirr for individual stock. Previous to lots, i was using assets:investments:stocks:AAPL syntax to get it. But in lots syntax that info is gone from account name so I can't filter it in roi command.
Method 1 — route the dividend through the investment account (classic roi idiom: the investment produced income, which was immediately withdrawn):
2022-05-23 dividend revenues:dividend:ltts -5.00 ₹ assets:investments:stocks:ltts 5.00 ₹ assets:investments:stocks:ltts -5.00 ₹ assets:cash:airtel_bank 5.00 ₹The ₹ postings in a lot-tracked account are harmless — ₹ isn't lotful, so the lot machinery ignores them, and the journal loads cleanly.
Method 2 — keep per-ticker parent accounts. With
assets:investments:stocks:ltts, lots nest underneath (...:ltts:{2022-04-06, ...}). That gives--inva clean per-stock handle (thecur:LTTSalternative can't work here, because the dividend postings are in ₹). This also re-answers Q3; theholdingsreport groups nicely by ticker with this account scheme.
Then per-stock roi including dividends:
hledger roi --inv assets:investments:stocks:ltts --pnl 'revenues:dividend:ltts|revenues:gain|equity:unrealised-gain' --value=end,₹ --infer-market-prices(gain accounts in
--pnlper the manual's "Using roi with lots" section). Verified against the variant journal: the 5 ₹ moves from contributed cashflow (4,350 → 4,345) into PnL (10,250 → 10,255), IRR rises 321.95% → 322.55%, and TWR gains a valuation window at the dividend date.
For `roi`, I'll share these AI answers - if you can confirm, I'll mention these in the manual.Method 1