Caplet Volatility Surface Construction

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

Caplet Volatility Surface Construction

Gouthaman Balaraman
I am using QuantLib python (version 1.8) to strip the caplet volatilities from the CapFloor vol surface. When I did that for a sample data, I noticed that at the short end of the tenor, the caplet and cap volatility surfaces did not match each other as shown in this example on
caplet stripping in QuantLib.

My understanding of the caplet stripping algorithm is that at the shortest end of the tenor for a given strike, the caplet volatilities are assumed to be the same as that of shortest CapFloor volatility. The caplet volatilities are then bootstrapped for increasing tenors to construct the caplet volatilities.


Another thing I couldn't figure how to pass the discount curve for the OptionletStripper1 class. The C++ class constructor definition is:

OptionletStripper1(const boost::shared_ptr< CapFloorTermVolSurface > &,
                           const boost::shared_ptr< IborIndex > &index,
                           Rate switchStrikes = Null< Rate >(),
                           Real accuracy = 1.0e-6, Natural maxIter = 100,
                           const Handle< YieldTermStructure > &discount =
                               Handle< YieldTermStructure >(),
                           const VolatilityType type = ShiftedLognormal,
                           const Real displacement = 0.0,
                           bool dontThrow = false);

I am not sure what would be the way to provide the discount variable. I tried:

optionlet_surf = ql.OptionletStripper1(capfloor_vol, ibor_index, discount=ts_handle)

This threw an error saying that 'discount' is not a recognized variable. I wanted to pass as arguments, but then I didn't understand the python equivalent of 'Null<Rate>()' to pass all the default args.

Any help would be much appreciated.

Goutham


Reply | Threaded
Open this post in threaded view
|

Re: Caplet Volatility Surface Construction

Luigi Ballabio
As for the call with a discount curve: for the time being, ql.nullDouble() will give you a Null<Real> that you can pass to the constructor.  If you want to recompile, instead, you can enable keyword arguments by adding

    %feature("kwargs") OptionletStripper1Ptr;

to the OptionletStripper1Ptr class, before the %extend block. It's not always possible (it isn't if there's more than one constructor) but it should work in this case.

Luigi



On Fri, Jun 24, 2016 at 4:50 PM Gouthaman Balaraman <[hidden email]> wrote:
I am using QuantLib python (version 1.8) to strip the caplet volatilities
from the CapFloor vol surface. When I did that for a sample data, I noticed
that at the short end of the tenor, the caplet and cap volatility surfaces
did not match each other as shown in this example on
caplet stripping in QuantLib
<http://gouthamanbalaraman.com/blog/interest-rate-cap-floor-valuation-quantlib-python.html>
.

My understanding of the caplet stripping algorithm is that at the shortest
end of the tenor for a given strike, the caplet volatilities are assumed to
be the same as that of shortest CapFloor volatility. The caplet volatilities
are then bootstrapped for increasing tenors to construct the caplet
volatilities.


Another thing I couldn't figure how to pass the discount curve for the
OptionletStripper1 class. The C++ class constructor definition is:

OptionletStripper1(const boost::shared_ptr< CapFloorTermVolSurface > &,
                           const boost::shared_ptr< IborIndex > &index,
                           Rate switchStrikes = Null< Rate >(),
                           Real accuracy = 1.0e-6, Natural maxIter = 100,
                           const Handle< YieldTermStructure > &discount =
                               Handle< YieldTermStructure >(),
                           const VolatilityType type = ShiftedLognormal,
                           const Real displacement = 0.0,
                           bool dontThrow = false);

I am not sure what would be the way to provide the discount variable. I
tried:

optionlet_surf = ql.OptionletStripper1(capfloor_vol, ibor_index,
discount=ts_handle)

This threw an error saying that 'discount' is not a recognized variable. I
wanted to pass as arguments, but then I didn't understand the python
equivalent of 'Null<Rate>()' to pass all the default args.

Any help would be much appreciated.

Goutham






--
View this message in context: http://quantlib.10058.n7.nabble.com/Caplet-Volatility-Surface-Construction-tp17561.html
Sent from the quantlib-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Caplet Volatility Surface Construction

Gouthaman Balaraman
Thanks. This was helpful.