QuantLib Python enum problems

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

QuantLib Python enum problems

Ryan Mills-2
Hi Guys,

I am new to QuantLib, but I am about to begin work at a financial company, and likely I will use QuantLib for work and personal projects.

All in all, it looks like a lot of work, and I greatly appreciate it being out there to give a solid financial framework.

I managed to install QuantLib-Python 0.3.10 on OS X 10.4.5, and to my knowledge, this has not been widely done as fink still does not have 10.4 support. I wrote a blog about it at: http://mills.zapto.org/wordpress

Two things:
First:
the quantlib-config should include the location of the directories I passed in to ./configure for the boost directories. It causes problems for QuantLib-Python if quantlib-config is not in there, and modified to include the boost directories. The --with-boost-lib and --with-boost-include should be enough indication to put those directories into quantlib-config.

Second:
I am using python, and I am having some problems creating and using the objects because many of them rely on various enums. QuantLib::TimeUnit, and QuantLib::Frequency come to mind. Basically I am just getting started by trying to use InterestRate to caluclate some expected values. Any chance there is a Python FAQ for QuantLib around anywhere with instructions on how to use the objects or where the enums are stored in Python? I cannot find the enums anywhere. If I do end up figuring it up, perhaps the examples can be added somewhere for future python developers.

http://www.quantlib.org/reference/group__datetime.html#g8b62b8023ffd8b289d40e30c630977dd

Regards,
Ryan Mills
Reply | Threaded
Open this post in threaded view
|

Re: QuantLib Python enum problems

Luigi Ballabio
On Feb 25, 2006, at 10:38 AM, Ryan Mills wrote:
> I managed to install QuantLib-Python 0.3.10 on OS X 10.4.5, and to my
> knowledge, this has not been widely done as fink still does not have
> 10.4 support. I wrote a blog about it at:
> http://mills.zapto.org/wordpress

Nice. I'll keep the link handy in case someone asks.

> Two things:
> First:
> the quantlib-config should include the location of the directories I
> passed in to ./configure for the boost directories. It causes problems
> for QuantLib-Python if quantlib-config is not in there, and modified
> to include the boost directories. The --with-boost-lib and
> --with-boost-include should be enough indication to put those
> directories into quantlib-config.

Done. It will work in next release.


> Second:
> I am using python, and I am having some problems creating and using
> the objects because many of them rely on various enums.
> QuantLib::TimeUnit, and QuantLib::Frequency come to mind. Basically I
> am just getting started by trying to use InterestRate to caluclate
> some expected values. Any chance there is a Python FAQ for QuantLib
> around anywhere with instructions on how to use the objects or where
> the enums are stored in Python? I cannot find the enums anywhere. If I
> do end up figuring it up, perhaps the examples can be added somewhere
> for future python developers.

Yes, documentation is a sore spot of the project.  Anyway, in recent
releases (let me check your blog again... hmm, you're using 0.3.10. I
don't remember in which version we made the change)  most enumerations
are exported in the module namespace (i.e., QuantLib.Weeks or
QuantLib.Annual.) In earlier releases you had to pass them as strings
("weeks" or "annual".) If 0.3.10 still has the string version, I
suggest you jump on 0.3.11 before you write much code, or you'll have
to change it down the road.

Later,
        Luigi