Skip to content

roi valuation refuses to unify accounts, gives incorrect recommendation #2190

Description

@aragaer

Given the following journal file:

P 2023-01-01 B 20A
P 2023-01-01 C 1B

2023-01-01
 investment  1C @@ 20A
 investment  4B @@ 80A
 assets

P 2023-12-31 C 2B

If I want to get ROI "in units of B", I'm expecting to see something like this:

$ hledger -f /tmp/test.journal roi --inv investment --pnl income --value='end,B' -e2024
+---++------------+------------++---------------+----------+-------------+-----++--------++------------+----------+
|   ||      Begin |        End || Value (begin) | Cashflow | Value (end) | PnL ||    IRR || TWR/period | TWR/year |
+===++============+============++===============+==========+=============+=====++========++============+==========+
| 1 || 2023-01-01 | 2023-12-31 ||             0 |       5B |          6B |  1B || 20.00% ||     20.00% |   20.00% |
+---++------------+------------++---------------+----------+-------------+-----++--------++------------+----------+

But instead I get an error Error: Amounts could not be converted to a single cost basis: ["2B","4B @@ 80A"] with a recommendation to add --cost.

Adding --cost helps remove the error message, but gives an incorrect result:

$ hledger -f /tmp/test.journal roi --inv investment --pnl income --value='end,B' -e2024 --cost
+---++------------+------------++---------------+----------+-------------+-----++-------++------------+----------+
|   ||      Begin |        End || Value (begin) | Cashflow | Value (end) | PnL ||   IRR || TWR/period | TWR/year |
+===++============+============++===============+==========+=============+=====++=======++============+==========+
| 1 || 2023-01-01 | 2023-12-31 ||             0 |       5B |          5B |   0 || 0.00% ||      0.00% |    0.00% |
+---++------------+------------++---------------+----------+-------------+-----++-------++------------+----------+

How should I change my query (or perhaps my journal) to see that 20% IRR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.docsDocumentation-related.roi

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions