[Numpy-discussion] add xirr to numpy financial functions?
Charles R Harris
charlesr.harris@gmail....
Tue May 26 00:38:26 CDT 2009
On Mon, May 25, 2009 at 6:55 PM, <josef.pktd@gmail.com> wrote:
> On Mon, May 25, 2009 at 7:27 PM, <josef.pktd@gmail.com> wrote:
> >> The advantage of Skippers implementation using actual dates instead of
> >> just an array of numbers is that it is possible to directly calculate
> >> the annual irr, since the time units are well specified. The only
> >> problem is the need for an equation solver in numpy. Just using a date
> >> tuple would remove the problem of string parsing, and it might be
> >> possible to extend it later to a date array.
> >>
> >> So, I think it would be possible to include Skippers solution, with
> >> some cleanup and testing, if an equation solver can be found or if
> >> np.roots can handle high order (sparse) polynomials.
> >>
> >
> > I looked a bit more: the current implementation of ``rate`` uses it's
> > own iterative (Newton) solver, and in a similar way this could be done
> > for a more general xirr.
> >
> > So with a bit of work this doesn't seem to be a problem and the only
> > question that remains is the specification of the dates.
>
>
> Here is a solver using the polynomial class, or is there something
> like this already in numpy
>
No. But I think numpy might be a good place for one of the simple 1D
solvers. The Brent one would be a good choice as it includes bisection as a
fallback strategy. Simple bisection might also be worth adding. The current
location of these solvers in scipy.optimize is somewhat obscure and they are
the sort of function that gets used often. They don't really fit if we stick
to an "arrays only" straight jacket in numpy, but polynomials and financial
functions seem to me even further from the core.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090525/7c748970/attachment-0001.html
More information about the Numpy-discussion
mailing list