Anexen / pyxirr

Rust-powered collection of financial functions.
https://anexen.github.io/pyxirr/
The Unlicense
172 stars 16 forks source link

pyxirr bug #60

Closed PAgrawal16 closed 5 days ago

PAgrawal16 commented 1 week ago

Hi, I am calculating xirr using pyxirr and excel. Excel gives value ~0 but pyxirr gives -0.5925. Can you please check. I am using latest version 0.10.6 t.csv

Can you please check.

df = pd.read_csv("t.csv")

from pyxirr import xirr xirr(df.Date, df.investment)

Anexen commented 5 days ago

@PAgrawal16 , this is not a pyxirr bug, but an error in Excel. You didn't provide the exact number that excel returned, but I can guess that it's 2.98023E-09 (which is approximately zero).

By the definition, XIRR is equals to the rate at which XNPV = 0. There is no way for XNPV to be close to zero with the rate close to zero:

image

You may also find the Multiple IRR Problem section in the README useful.