SwapRateHelper Question - SWIG Python
Posted by Ioan F. on May 21, 2014; 4:27pm
URL: http://quantlib.414.s1.nabble.com/SwapRateHelper-Question-SWIG-Python-tp15297.html
Hello,
I am trying to expose a new type of the SwapRateHelper constructor (already existent in QuantLib) to Python.
In the ratehelpers.i interface file, I added the following code:
//ADDED
SwapRateHelperPtr(
const Handle<Quote>& rate,
const Period &tenor,
const Calendar &calendar,
Frequency fixedFrequency,
BusinessDayConvention fixedConvention,
const DayCounter &fixedDayCount,
const boost::shared_ptr<IborIndex> &index,
const Handle<Quote> &spread=Handle<Quote>(),
const Period &fwdStart=0 *Days,
const Handle<YieldTermStructure> &discountingCurve=Handle<YieldTermStructure>()) {
boost::shared_ptr<IborIndex> libor =
boost::dynamic_pointer_cast<IborIndex>(index);
return new SwapRateHelperPtr(
new SwapRateHelper(rate, tenor, calendar,
fixedFrequency, fixedConvention,
fixedDayCount, libor,
spread, fwdStart,
discountingCurve));
//END ADDED
I was able to wrap, build and install the QuantLib library (via SWIG) into Python, but when I try to use the SwapRateHelper in Python, I get the following error:
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_SwapRateHelper'.
Possible C/C++ prototypes are:....
The following code works:
qqq=SwapRateHelper(QuoteHandle(eurLiborSwaps[(2, Years)]),
Period(2, Years),
euroCalendar,
fixedLegFrequency,
fixedLegAdjustment,
fixedLegDayCounter,
EURLibor3M(),
QuoteHandle(),
Period(0,0))
while this one causes the problem:
qqq=SwapRateHelper(QuoteHandle(eurLiborSwaps[(2, Years)]),
Period(2, Years),
euroCalendar,
fixedLegFrequency,
fixedLegAdjustment,
fixedLegDayCounter,
EURLibor3M(),
QuoteHandle(),
Period(0,0),
eoniaHandle)
Furthermore, please note that Python reports the type of the eoniaHandle variable as:
QuantLib.QuantLib.YieldTermStructureHandle
Any help or suggestions are highly appreciated.
Since this is my first time posting, please excuse any breaking of the "mailing list etiquette."
Thank you,
Ioan