xirr
xirr copied to clipboard
Wrong IRR at a specific threshold
I've not yet been able to pinpoint what is going on here. Will try to narrow it down further when I get a chance.
But this gives the right results:
[5] pry(#<IRR>)> both
=> [T(-627752.0,2017-02-23), T(-75167.0,2017-11-07), T(6.9,2020-03-01)]
[6] pry(#<IRR>)> both.xirr
=> -0.984602e0
This does not:
=> [T(-627752.0,2017-02-23), T(-75167.0,2017-11-07), T(6.8,2020-03-01)]
[3] pry(#<IRR>)> both.xirr
=> 0.0
The expected value would be converging towards -1 as the positive amount in the last transaction converges on 0. As far as I can tell, somewhere between 6.9 and 6.8 is the last point where it gets the correct results.