numpy-financial
numpy-financial copied to clipboard
XIRR for non-periodic cash flows?
Both Excel and LibreOffice provide XIRR to calculate the IRR for non-periodic cash flows. Do we have a plan to add this feature?
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.
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)
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