numpy-financial icon indicating copy to clipboard operation
numpy-financial copied to clipboard

XIRR for non-periodic cash flows?

Open xuhdev opened this issue 4 years ago • 3 comments

Both Excel and LibreOffice provide XIRR to calculate the IRR for non-periodic cash flows. Do we have a plan to add this feature?

xuhdev avatar Apr 06 '20 21:04 xuhdev

FYI: This was discussed on the NumPy mailing list back in 2009: https://mail.python.org/pipermail/numpy-discussion/2009-May/042645.html

I don't know of a plan to add it. (Although I had a big role in creating this repo, I don't have a lot of time to work on it these days, and I personally have no specific plans for new additions.) If there is agreement on the xirr API, I don't think there would be any objections to adding it. It might require poking folks who have expressed interest in numpy-financial to work out a correct API, and then get someone to create a pull request.

WarrenWeckesser avatar Apr 09 '20 11:04 WarrenWeckesser

It is very easy to build your own XIRR function. This stackoverflow answer is a good example: https://stackoverflow.com/a/66069439/4045275

If instead you have very specific needs with respect to day count conventions, using an explicit library like QuantLib might be better (but it's a bit overkill to use it just for an NPV / IRR calculation)

garfieldthecat avatar Feb 10 '21 14:02 garfieldthecat

I tried with https://pypi.org/project/pyxirr/ which supports xirr .

The issue I encountered with was that it is using rust under the hood.

If I'm trying to run with PyScript which doesn't support such library. It would be great to have an implementation without dependency of rust

yellowbean avatar Dec 21 '23 06:12 yellowbean