|
Never mind, I figured it out.
Rather than %include hestonprocess.hpp I copied and pasted the class definition into stochasticprocess.i and changed Disposable<Array> to Array. It seems to work.
kmanley wrote
Hi--
I'm trying to access HestonProcess from Python.
First I added
%include "c:\quantlib-0.9.6\ql\processes\hestonprocess.hpp"
to
stochasticprocess.i
Then I regenerated the swig wrapper and rebuilt _QuantLib.pyd
I can now create a HestonProcess from Python but I'm having trouble using functions that return Array types. For example below initialValues() should return a 2-element array, but I instead get 'PySwigObject'
Any help would be appreciated.
Thanks, Kevin
>>> from QuantLib import *
>>> today = Date(15, October, 2008)
>>> riskFreeRate = FlatForward(today, 0.05, Actual365Fixed())
>>> dividendRate = FlatForward(today, 0.03, ActualActual())
>>> hp = HestonProcess(YieldTermStructureHandle(riskFreeRate), YieldTermStructureHandle(dividendRate),
... QuoteHandle(SimpleQuote(1000)), .40, 2.0, 0.04, 0.39, -0.64)
>>> x = hp.initialValues()
>>> type(x)
swig/python detected a memory leak of type 'Disposable< Array > *', no destructor found.
<type 'PySwigObject'> >>> x[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module> TypeError: 'PySwigObject' object is unsubscriptable
|