python binding(and SWIG interface in general)

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

python binding(and SWIG interface in general)

garyng
Hi,

I tried to use the python binding instead of C++ but it seems that if I want
to do anything that is not in quantlib, I still need to program them in C++
then expose my implementation in SWIG, instead of implementing the logic in
python. Is this the intended usage of the binding ?

For example, the Hull White short rate model binding in python is exposed as
the top level short rate model class instead of the Hull White C++ class. As
a result, I cannot access those public members that is supposed to be in
Hull White like tree(), dynamics(), discount(), discountBond().

What I want to do is to implment some simple MBS using Monte Carlo and the
Hull White model, kind of following the path of the Discrete Hedging
example.

thanks for any pointer or help in advance.

regards,

gary








Reply | Threaded
Open this post in threaded view
|

Re: python binding(and SWIG interface in general)

Luigi Ballabio
On 03/25/2006 05:41:29 AM, gary ng wrote:
> I tried to use the python binding instead of C++ but it seems that if
> I want to do anything that is not in quantlib, I still need to  
> program them in C++ then expose my implementation in SWIG, instead of  
> implementing the logic in python. Is this the intended usage of the  
> binding ?

It is not the intended usage, but the bindings often lag a bit behind  
the library. In your case, the bindings should be extended so that  
HullWhite public members are exposed. I'll try and do it for next  
release---or you can modify shortratemodels.i and send me a patch. Feel  
free to ask for advice if you undertake the task.

Later,
        Luigi


----------------------------------------

Hofstadter's Law:
         It always takes longer than you expect, even when you take
         Hofstadter's Law into account.