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

josef.pktd@gmai... josef.pktd@gmai...
Mon May 25 21:00:46 CDT 2009

On Mon, May 25, 2009 at 9:18 PM, Matt Knox <mattknox.ca@gmail.com> wrote:
> forgive me for jumping in on this thread and playing devil's advocate here, but
> I am a natural pessimist so please bear with me :) ...

It's good to hear from a real finance person.

> I think as this discussion has already demonstrated, it is *extremely*
> difficult to build a solid general purpose API for financial functions (even
> seemingly simple ones like an IRR calculation) because of the endless amount
> of possible permutations and interpretations. I think it would be a big
> mistake to add more financial functions to numpy directly without having them
> mature independently in a separate (scikits) package first. It is virtually
> guaranteed that you won't get the API right on the first try and adding the
> functions to numpy locks you into an API commitment because numpy is supposed
> to be a stable package with certain guarantees for backwards compatibility.

> And as for a more fully featured finance/quant module in Python... someone has
> already mentioned the C++ library, QuantLib - which I use extensively at work
> - and I think any serious effort to improve Python's capabilities in this area
> would be best spent on building a good Python/numpy interface to QuantLib
> rather than reimplementing its very substantial functionality (which is
> probably an impossible task realistically).

Quantlib might be good for heavy duty work, but when I looked at their
code, I wouldn't know where to start if I want to rewrite any
algorithm. My benchmark is more scripting with matlab, where maybe
some pieces are readily available, but where the code needs also to be
strongly adjusted, or we want to implement a new method or prototype
for one.

I hadn't tried very hard, but I didn't manage to get Boost and
quantlib correctly compiled with the python bindings with MingW.

So, while python won't get any "industrial strength" finance package,
a more modest "designer package" would be feasible, if there were any
interest in it (which I haven't seen).

It is similar with statistics, there is no way to achieve the same
coverage of statistics as R for example, but still I find in many
different python packages many of the basic statistics functions are
implemented, without running immediately to R, not to mention the
multitude (and multiplicity) of available machine learning packages in
The other group of python packages cover very specialized requirement
of the statistical analysis, as for example the neuroimaging groups.

The even more modest question is whether we would want to match open
office in it's finance part.

These are pretty different use cases from those use cases where you
have quantlib all set up and running.

(I also saw a book announcement for Finance with Python, I don't
remember the exact title.)


More information about the Numpy-discussion mailing list