Re: Subclassing (the RateHelper) in Python

Posted by Nabil Layaida on
URL: http://quantlib.414.s1.nabble.com/Subclassing-the-RateHelper-in-Python-tp4133p4135.html


Hi Luigi,

I am porting the cpp testsuite In Java.
I am looking for covering the entire testsuite and the
work is progressing rapidly.
Luigi, Do you think it will have a value in putting this in the
CVS base sometime. A significant part of the test suite
passes already in Java :)

I need a help from a SWIG Interface person
to help me get through. In fact, I don't find the interface for the following
cases :

- the capfloor ImpliedVolatility method in the wrappers.
 Capfloor has been split into its sub-classes, Cap, Floor and Collar
but no Capfloor where ImpliedVolatility id defined.

- In CompoundForward class, there is no methods
  corresponding to the C++ method :
             Rate compoundForward(const Date& d1,
                      Integer f,
                     bool extrapolate = false) const;
               Rate compoundForward(Time t1,
                      Integer f,
                     bool extrapolate = false) const;

- The Class GapPayoff : public StrikedTypePayoff is not interfaced in SWIG

- The Class  CapletConstantVolatility  and its  super class CapletVolatilitystructure
  are not interfaced.

 - The Class InarrearIndexedCoupon and Itssuper class IndexedCoupon are not interfaced.


Nabil



On 10/14/05, Luigi Ballabio <[hidden email]> wrote:

On 10/14/2005 11:24:10 AM, ago wrote:
> I am trying to subclass the RateHelper using python, so that the
> derived class (Inflation Linked Bond) can be used within the
> bootstrapper. I am struggling my way through c++, swig and the
> wrapper code, and so far I failed miserably with the error:
>
> NotImplementedError: No matching function for overloaded
> 'new_PiecewiseFlatForward'

I guess the wrappers didn't recognize instances of your class as rate
helpers. What was the interface you exported? Can you post the relevant
bit of the .i file?


> I then tried the "easier" task of subclassing (in python) the
> SwapRateHelper, overriding some of the methods for testing purposes.

That won't work. SWIG must be told to generate special code for that
(see the SWIG documentation for "directors".) However, I'm under the
impression that it would not work because we're exporting smart
pointers rather than the actual classes.

Later,
        Luigi


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

To err is human -- to blame it on a computer is even more so.
-- unknown



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users