Skip to content

Commit

Permalink
roi: new testcase from simonmichael#2298
Browse files Browse the repository at this point in the history
  • Loading branch information
adept committed Dec 11, 2024
1 parent b067e4d commit 6a071e0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions hledger/test/roi.test
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,32 @@ $ hledger -f - roi --inv investment --pnl income --value='end,B' -b2023 -e2024
+---++------------+------------++---------------+----------+-------------+-----++--------++------------+----------+

>= 0

# ** 16. Correcly process dates with just pricing changes
<
D 1,000.00 EUR

2018-07-01 investment
assets:bank
investments:iShares Core MSCI World 1 "IE00B4L5Y983"

P 2018-12-28 "IE00B4L5Y983" 43.11000000 "EUR"
P 2019-06-28 "IE00B4L5Y983" 50.93000000 "EUR"

2019-07-01 investment
assets:bank
investments:iShares Core MSCI World 10 "IE00B4L5Y983"

P 2019-12-30 "IE00B4L5Y983" 56.59000000 "EUR"

$ hledger -f - roi --value then --begin 2019 --end 2020 --inv investmen --pnl '"profit and loss"' -p 'every 2 quarters'
+-------++------------+------------++---------------+------------+-------------+-----------++--------++------------+----------+
| || Begin | End || Value (begin) | Cashflow | Value (end) | PnL || IRR || TWR/period | TWR/year |
+=======++============+============++===============+============+=============+===========++========++============+==========+
| 1 || 2019-01-01 | 2019-06-30 || 43.11 EUR | 0 | 50.93 EUR | 7.82 EUR || 39.96% || 18.14% | 39.96% |
| 2 || 2019-07-01 | 2019-12-31 || 50.93 EUR | 509.30 EUR | 622.49 EUR | 62.26 EUR || 23.25% || 11.11% | 23.24% |
+-------++------------+------------++---------------+------------+-------------+-----------++--------++------------+----------+
| Total || 2019-01-01 | 2019-12-31 || 43.11 EUR | 509.30 EUR | 622.49 EUR | 70.08 EUR || 24.51% || 31.27% | 31.27% |
+-------++------------+------------++---------------+------------+-------------+-----------++--------++------------+----------+

>= 0

0 comments on commit 6a071e0

Please sign in to comment.