Skip to content
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

IRR precision #47

Open
vonba opened this issue Sep 27, 2019 · 1 comment
Open

IRR precision #47

vonba opened this issue Sep 27, 2019 · 1 comment

Comments

@vonba
Copy link

vonba commented Sep 27, 2019

Hello!

I'm seeing a discrepancy calculating IRR compared to Excel. It isn't huge, but when annualising it is enough for it to be a problem.

Consider the following code.

cashFlow = [-206136.99, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 8993.21, 18993.21];
// Calculate monthly IRR
IRR = finance.IRR( { depth: 1500, cashFlow: cashFlow } );
// Annualise IRR
IRR = (Math.pow(1 + IRR / 100, 12) - 1) * 100;

This returns 0.72% (exactly) which annually becomes 8.99% (8.990490026994502).
Compared to Excel which gives me 0.71414% monthly and 8.91% annually (0.0891443135).

I would appreciate any clues as to why this is happening. I find the exact 0.72 a bit suspicious, is it possible that some rounding is happening there?

Cheers!

@egodigitus
Copy link

Wasn't happy with the IRR result from this lib either. Found a fork which returns better results
https://github.com/kgkars/tvm-financejs
According to the readme it's tested to be correct against Microsoft Excel for Office 365 from March 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants