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

Regression xirr does not ensure cash flows are sorted #19

Open
okomarov opened this issue Feb 8, 2023 · 1 comment · May be fixed by #20
Open

Regression xirr does not ensure cash flows are sorted #19

okomarov opened this issue Feb 8, 2023 · 1 comment · May be fixed by #20

Comments

@okomarov
Copy link

okomarov commented Feb 8, 2023

In 2.0.3 we've got:

xirr([
  {amount: -50000, date: new Date('2019/01/01')},
  {amount: -50000, date: new Date('2020/01/01')},
  {amount: 162500, date: new Date('2021/01/01')}
])

> { days: 732, rate: 0.0008630264819782241 }

xirr([
  {amount: -50000, date: new Date('2020/01/01')},
  {amount: -50000, date: new Date('2019/01/01')},
  {amount: 162500, date: new Date('2021/01/01')}
])

> { days: 732, rate: 0.0008630264819782241 }

While in 2.0.5, the second case, i.e. 2019 after 2020, the result changes to:

{ days: 732, rate:   0.003225559800975386 }
@alias-rahil alias-rahil linked a pull request May 19, 2023 that will close this issue
@alias-rahil
Copy link

alias-rahil commented May 19, 2023

@eric-malachias @okomarov please take a look at #20

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

Successfully merging a pull request may close this issue.

2 participants