-
-
Notifications
You must be signed in to change notification settings - Fork 343
Open
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects3-fewAffects just a few users.Affects just a few users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.roi
Description
The docs for roi (man hledger > search for roi) mention:
--pnl could be an empty query (--pnl "" or --pnl STR where STR does not match any of your accounts).
However, when I run the command with an empty pnl, I get an error. If I specify, e.g. "^$" instead, it does work.
I think that if the user doesn't specify any --pnl flag, the command should still work and just not match any accounts.
To reproduce, save the below to /tmp/roi.journal
commodity €1,000.00
commodity 1000.0 TICK
2025-08-14 IBKR | TICK
assets:broker:investing:TICK 48 TICK @ €10.454
assets:broker:checking €-503.08
expenses:banking:broker:investing:transferfees €1.29
equity:rounding €-0.002
2025-09-16 IBKR | TICK
assets:broker:investing:TICK 46.8918 TICK @ €10.662831
assets:broker:checking €-501.25
expenses:banking:broker:investing:transferfees €1.25
equity:rounding €0.0006613142
2025-10-06 IBKR | TICK
assets:broker:investing:TICK 45.5987 TICK @ €10.965201
assets:broker:checking €-501.25
expenses:banking:broker:investing:transferfees €1.25
equity:rounding €0.0010891613
2025-10-23 IBKR | TICK
assets:broker:investing:TICK 16.3 TICK @ €11.004
assets:broker:checking €-180.63
expenses:banking:broker:investing:transferfees €1.27
equity:rounding €-0.0052
P 2025-08-14 00:00:00 TICK €10.4540004730224609375
P 2025-08-15 00:00:00 TICK €10.4340000152587890625
P 2025-08-18 00:00:00 TICK €10.4540004730224609375
P 2025-08-19 00:00:00 TICK €10.451999664306640625
P 2025-08-20 00:00:00 TICK €10.39400005340576171875
P 2025-08-21 00:00:00 TICK €10.4340000152587890625
P 2025-08-22 00:00:00 TICK €10.49400043487548828125
P 2025-08-25 00:00:00 TICK €10.50800037384033203125
P 2025-08-26 00:00:00 TICK €10.47000026702880859375
P 2025-08-27 00:00:00 TICK €10.54399967193603515625
P 2025-08-28 00:00:00 TICK €10.52600002288818359375
P 2025-08-29 00:00:00 TICK €10.4340000152587890625
P 2025-09-01 00:00:00 TICK €10.4619998931884765625
P 2025-09-02 00:00:00 TICK €10.34799957275390625
P 2025-09-03 00:00:00 TICK €10.423999786376953125
P 2025-09-04 00:00:00 TICK €10.4899997711181640625
P 2025-09-05 00:00:00 TICK €10.44600009918212890625
P 2025-09-08 00:00:00 TICK €10.50599956512451171875
P 2025-09-09 00:00:00 TICK €10.5179996490478515625
P 2025-09-10 00:00:00 TICK €10.59799957275390625
P 2025-09-11 00:00:00 TICK €10.65200042724609375
P 2025-09-12 00:00:00 TICK €10.65799999237060546875
P 2025-09-15 00:00:00 TICK €10.67599964141845703125
P 2025-09-16 00:00:00 TICK €10.60200023651123046875
P 2025-09-17 00:00:00 TICK €10.59200000762939453125
P 2025-09-18 00:00:00 TICK €10.69200038909912109375
P 2025-09-19 00:00:00 TICK €10.7779998779296875
P 2025-09-22 00:00:00 TICK €10.7320003509521484375
P 2025-09-23 00:00:00 TICK €10.7600002288818359375
P 2025-09-24 00:00:00 TICK €10.72799968719482421875
P 2025-09-25 00:00:00 TICK €10.73400020599365234375
P 2025-09-26 00:00:00 TICK €10.71399974822998046875
P 2025-09-29 00:00:00 TICK €10.7600002288818359375
P 2025-09-30 00:00:00 TICK €10.73400020599365234375
P 2025-10-01 00:00:00 TICK €10.840000152587890625
P 2025-10-02 00:00:00 TICK €10.881999969482421875
P 2025-10-03 00:00:00 TICK €10.923999786376953125
P 2025-10-06 00:00:00 TICK €10.9759998321533203125
P 2025-10-07 00:00:00 TICK €10.94999980926513671875
P 2025-10-08 00:00:00 TICK €11.04199981689453125
P 2025-10-09 00:00:00 TICK €11.05799961090087890625
P 2025-10-10 00:00:00 TICK €10.83800029754638671875
P 2025-10-13 00:00:00 TICK €10.91800022125244140625
P 2025-10-14 00:00:00 TICK €10.8859996795654296875
P 2025-10-15 00:00:00 TICK €10.93000030517578125
P 2025-10-16 00:00:00 TICK €10.9540004730224609375
P 2025-10-17 00:00:00 TICK €10.80799961090087890625
P 2025-10-20 00:00:00 TICK €10.98400020599365234375
P 2025-10-21 00:00:00 TICK €11.04199981689453125
P 2025-10-22 00:00:00 TICK €10.94999980926513671875
P 2025-10-23 00:00:00 TICK €11.034000396728515625
then run:
hledger roi --file="/tmp/roi.journal" --value="then,€" --inv "^assets:.*:TICK$" --pnl ""
which results in
hledger: Error: Error (NotBracketed): No solution for Internal Rate of Return (IRR).
Possible causes: IRR is huge (>1000000%), balance of investment becomes negative at some point in time.
whereas if we specify it with "^$" we do get expected output.
hledger roi --file="/tmp/roi.journal" --value="then,€" --inv "^assets:.*:TICK$" --pnl "^$"
+---++------------+------------++---------------+-----------+-------------+--------++--------++------------+----------+
| || Begin | End || Value (begin) | Cashflow | Value (end) | PnL || IRR || TWR/period | TWR/year |
+===++============+============++===============+===========+=============+========++========++============+==========+
| 1 || 2025-08-14 | 2025-10-23 || 0 | €1,681.16 | €1,730.03 | €48.87 || 31.52% || 4.98% | 28.36% |
+---++------------+------------++---------------+-----------+-------------+--------++--------++------------+----------+
Metadata
Metadata
Assignees
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects3-fewAffects just a few users.Affects just a few users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.roi