Skip to content

Wrong results on clean trade record dataset #72

@monissa-blake

Description

@monissa-blake

Hi, here are my trade records:

        dates    amounts
0  2008-01-21 -26.201664
1  2008-01-22  28.204748
2  2008-10-10 -25.609337
3  2008-10-13  27.471967
4  2008-12-17 -15.539259
5  2008-12-29  12.937634
6  2009-01-19 -11.579093
7  2009-01-22  10.831304
8  2009-02-02 -11.577097
9  2009-02-04  12.156783
10 2011-09-12 -13.066551
11 2011-09-13  13.246472
12 2011-11-01 -14.440242
13 2011-11-03  14.763795
14 2016-06-24 -24.641554
15 2016-06-29  22.719878
16 2020-03-09 -23.999442
17 2020-03-10  24.802491
18 2020-03-12 -22.086328
19 2020-03-13  23.743891
20 2020-03-16 -19.685434
21 2020-03-20  19.447014
22 2025-10-20 -67.723413
23 2025-10-21  67.593747

When I run this:

try:
    rate = pyxirr.xirr(df)
except Exception:
    rate = np.nan

print (rate)

I don't get any error and the output is 475962695445.82764 which is not the annual return.
I guess the numerical solvers may diverge, but I don't know why.
Is it a bug, or pyxirr can't deal with such data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions