-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't give proper IRR for very negative returns #33
Comments
@akayvanfar, out of curiosity, do you really have a cashflow that depends on the hour of the flow? I was thinking of replacing Time in favor of a Date. @x=[]
@x << Transaction.new(-10000.0, :date => Time.new(2014,4,15,0,0,0))
@x << Transaction.new(-10000.0, :date => Time.new(2014,04,16,0,0,0))
@x << Transaction.new(305.6, :date => Time.new(2014,05,16, 14,59,0))
@x << Transaction.new(9800.07, :date => Time.new(2014,06,15, 23, 59,59))
@x << Transaction.new(5052.645, :date => Time.new(2014,06,15, 23, 59,59))
@x.xirr.effective.round(6) # => -1.078485
@x.xirr(-80.0).effective.round(6) # => -0.809965 I've made a gem called XIRR that was based on finance that runs xirr calculations in two different methods. But it accepts only dates, so the result I get there is a bit different from yours: @x = Cashflow.new
@x << Transaction.new(-10000.0, :date => Date.new(2014,4,15))
@x << Transaction.new(-10000.0, :date => Date.new(2014,04,16))
@x << Transaction.new(305.6, :date => Date.new(2014,05,16))
@x << Transaction.new(9800.07, :date => Date.new(2014,06,15))
@x << Transaction.new(5052.645, :date => Date.new(2014,06,15))
@x.xirr # => -0.815121 Let me know if that is helpful. |
Thanks for the response. Weird that it is so dependent on the guess. Is there reason for that? Using 'Date' would be fine by me. I only used 'Time' since it is what the |
So the gem appears to incorrectly calculate IRR (using
xirr
) for highly negative returns. For example, using this set of cashflows / transactions2014-04-15 00:00:00 -0700 : -10000.0
2014-04-16 00:00:00 -0700 : -10000.0
2014-05-16 14:59:00 -0700 : 305.6
2014-06-15 23:59:59 -0700 : 9800.07
2014-06-15 23:59:59 -0700 : 5052.645
the gem gave an IRR of -107% while other tools gave an IRR of -80%. Can you guys look into this please?
Thank you.
AK
The text was updated successfully, but these errors were encountered: