[Numpy-discussion] add xirr to numpy financial functions?

Joe Harrington jh at physics.ucf.edu
Sun May 24 16:33:07 EDT 2009


I hate to ask for another function in numpy, but there's an obvious
one missing in the financial group: xirr.  It could be done as a new
function or as an extension to the existing np.irr.

The internal rate of return (np.irr) is defined as the growth rate
that would give you a zero balance at the end of a period of
investment given a series of cash flows into or out of the investment
at regular intervals (the first and last cash flows are usually an
initial deposit and a withdrawal of the current balance).

This is useful in academics, but if you're tracking a real investment,
you don't just withdraw or add money on a perfectly annual basis, nor
do you want a calc with thousands of days of zero entries just so you
can handle the uneven intervals by evening them out.  Both excel and
openoffice define a "xirr" function that pairs each cash flow with a
date.  Would there be an objection to either a xirr or adding an
optional second arg (or a keyword arg) to np.irr in numpy?  Who writes
the code is a different question, but that part isn't hard.

--jh--



More information about the NumPy-Discussion mailing list