Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Duplicate display of cashflow on the roi report #2316

Closed
sutehachi opened this issue Jan 19, 2025 · 3 comments · Fixed by #2317
Closed

Duplicate display of cashflow on the roi report #2316

sutehachi opened this issue Jan 19, 2025 · 3 comments · Fixed by #2317
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. roi

Comments

@sutehachi
Copy link

$ hledger -f test.journal roi -Y --inv investment --pnl "unrealized" --value=then --cashflow
IRR cash flow for 2019-01-01 - 2019-12-31
+------------++-----------+
|            ||    Amount |
+============++===========+
| 2019-01-01 || $-100.000 |
| 2019-01-02 ||   $90.000 |
| 2019-12-23 ||  $-90.000 |
| 2020-01-01 ||  $103.092 |
+------------++-----------+


TWR cash flow entries and subperiod rates for period 2019-01-01 - 2019-12-31
+------------++--------+-----------------+------------------+
|            || Amount | PnL on this day | Value afterwards |
+============++========+=================+==================+
| 2019-01-01 ||    100 |               0 |              100 |
| 2019-01-02 ||    -90 |               0 |               10 |
| 2019-12-23 ||     90 |               0 |           100.75 |
| 2019-12-31 ||      0 |               0 |           103.09 |
+------------++--------+-----------------+------------------+

+---++-----------------+---------------++----------------+----------+--------------+--------------++-----------------------+
|   || Subperiod start | Subperiod end || Value at start | Cashflow | PnL postings | Value at end || Subperiod return rate |
+===++=================+===============++================+==========+==============+==============++=======================+
| 1 ||      2019-01-01 |    2019-01-01 ||              0 |        0 |            0 |            0 ||                     1 |
| 2 ||      2019-01-01 |    2019-01-02 ||              0 |      100 |            0 |          100 ||                     1 |
| 3 ||      2019-01-02 |    2019-12-23 ||            100 |      -90 |            0 |        10.75 ||                  1.07 |
| 4 ||      2019-12-23 |    2019-12-31 ||          10.75 |       90 |            0 |       103.09 ||                  1.02 |
+---++-----------------+---------------++----------------+----------+--------------+--------------++-----------------------+
Total period TWR: 9.99%.
Period: 1.00 years.
Annualized TWR: 9.99%


IRR cash flow for 2019-01-01 - 2019-12-31
+------------++-----------+
|            ||    Amount |
+============++===========+
| 2019-01-01 || $-100.000 |
| 2019-01-02 ||   $90.000 |
| 2019-12-23 ||  $-90.000 |
| 2020-01-01 ||  $103.092 |
+------------++-----------+


TWR cash flow entries and subperiod rates for period 2019-01-01 - 2019-12-31
+------------++--------+-----------------+------------------+
|            || Amount | PnL on this day | Value afterwards |
+============++========+=================+==================+
| 2019-01-01 ||    100 |               0 |              100 |
| 2019-01-02 ||    -90 |               0 |               10 |
| 2019-12-23 ||     90 |               0 |           100.75 |
| 2019-12-31 ||      0 |               0 |           103.09 |
+------------++--------+-----------------+------------------+

+---++-----------------+---------------++----------------+----------+--------------+--------------++-----------------------+
|   || Subperiod start | Subperiod end || Value at start | Cashflow | PnL postings | Value at end || Subperiod return rate |
+===++=================+===============++================+==========+==============+==============++=======================+
| 1 ||      2019-01-01 |    2019-01-01 ||              0 |        0 |            0 |            0 ||                     1 |
| 2 ||      2019-01-01 |    2019-01-02 ||              0 |      100 |            0 |          100 ||                     1 |
| 3 ||      2019-01-02 |    2019-12-23 ||            100 |      -90 |            0 |        10.75 ||                  1.07 |
| 4 ||      2019-12-23 |    2019-12-31 ||          10.75 |       90 |            0 |       103.09 ||                  1.02 |
+---++-----------------+---------------++----------------+----------+--------------+--------------++-----------------------+
Total period TWR: 9.99%.
Period: 1.00 years.
Annualized TWR: 9.99%

+---++------------+------------++---------------+----------+-------------+--------++--------++------------+----------+
|   ||      Begin |        End || Value (begin) | Cashflow | Value (end) |    PnL ||    IRR || TWR/period | TWR/year |
+===++============+============++===============+==========+=============+========++========++============+==========+
| 1 || 2019-01-01 | 2019-12-31 ||             0 | $100.000 |    $103.092 | $3.092 || 25.22% ||      9.99% |    9.99% |
+---++------------+------------++---------------+----------+-------------+--------++--------++------------+----------+
@adept
Copy link
Collaborator

adept commented Jan 19, 2025

roi computes each report period separately, and then does one more computation for the overall period between the start and end date of report. There is no optimization for the case of total report interval having just one period, I am afraid

@adept
Copy link
Collaborator

adept commented Jan 19, 2025

However, we could optimize for this, see #2317

@sutehachi
Copy link
Author

Thank you !

@simonmichael simonmichael added roi A-WISH Some kind of improvement request, hare-brained proposal, or plea. labels Jan 21, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. roi
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants