Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
List of all members
KInterpolatedYoYOptionletVolatilitySurface< Interpolator1D > Class Template Reference

K-interpolated YoY optionlet volatility. More...

#include <qle/termstructures/kinterpolatedyoyoptionletvolatilitysurface.hpp>

+ Inheritance diagram for KInterpolatedYoYOptionletVolatilitySurface< Interpolator1D >:
+ Collaboration diagram for KInterpolatedYoYOptionletVolatilitySurface< Interpolator1D >:

Constructor

calculate the reference date based on the global evaluation date

ext::shared_ptr< YoYCapFloorTermPriceSurfacecapFloorPrices_
 
ext::shared_ptr< QuantLib::YoYInflationCapFloorEngine > yoyInflationCouponPricer_
 
ext::shared_ptr< YoYOptionletStripper > yoyOptionletStripper_
 
Interpolator1D factory1D_
 
Real slope_
 
bool lastDateisSet_
 
Date lastDate_
 
Interpolation tempKinterpolation_
 
std::pair< std::vector< Rate >, std::vector< Volatility > > slice_
 
 KInterpolatedYoYOptionletVolatilitySurface (const Natural settlementDays, const Calendar &, const BusinessDayConvention bdc, const DayCounter &dc, const Period &lag, const ext::shared_ptr< YoYCapFloorTermPriceSurface > &capFloorPrices, const ext::shared_ptr< QuantLib::YoYInflationCapFloorEngine > &pricer, const ext::shared_ptr< YoYOptionletStripper > &yoyOptionletStripper, const Real slope, const Interpolator1D &interpolator=Interpolator1D(), VolatilityType volType=ShiftedLognormal, Real displacement=0.0)
 
virtual Real minStrike () const override
 
virtual Real maxStrike () const override
 
virtual Date maxDate () const override
 
std::pair< std::vector< Rate >, std::vector< Volatility > > Dslice (const Date &d) const
 
virtual Volatility volatilityImpl (const Date &d, Rate strike) const
 
virtual Volatility volatilityImpl (Time length, Rate strike) const override
 
virtual void performCalculations () const
 
void updateSlice (const Date &d) const
 

Detailed Description

template<class Interpolator1D>
class QuantExt::KInterpolatedYoYOptionletVolatilitySurface< Interpolator1D >

K-interpolated YoY optionlet volatility.

The stripper provides curves in the T direction along each K. We don't know whether this is interpolating or fitting in the T direction. Our K direction interpolations are not model fitting.

An alternative design would be a FittedYoYOptionletVolatilitySurface taking a model, e.g. SABR in the interest rate world. This could use the same stripping in the T direction along each K.

Bug:
Tests currently fail.

Definition at line 60 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

Constructor & Destructor Documentation

◆ KInterpolatedYoYOptionletVolatilitySurface()

KInterpolatedYoYOptionletVolatilitySurface ( const Natural  settlementDays,
const Calendar &  cal,
const BusinessDayConvention  bdc,
const DayCounter &  dc,
const Period &  lag,
const ext::shared_ptr< YoYCapFloorTermPriceSurface > &  capFloorPrices,
const ext::shared_ptr< QuantLib::YoYInflationCapFloorEngine > &  pricer,
const ext::shared_ptr< YoYOptionletStripper > &  yoyOptionletStripper,
const Real  slope,
const Interpolator1D &  interpolator = Interpolator1D(),
VolatilityType  volType = ShiftedLognormal,
Real  displacement = 0.0 
)

Definition at line 110 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

124 : YoYOptionletVolatilitySurface(settlementDays, cal, bdc, dc, lag,
125 capFloorPrices->yoyIndex()->frequency(),
126 capFloorPrices->yoyIndex()->interpolated(),
127 volType, displacement),
128 capFloorPrices_(capFloorPrices), yoyInflationCouponPricer_(pricer),
129 yoyOptionletStripper_(yoyOptionletStripper),
130 factory1D_(interpolator), slope_(slope), lastDateisSet_(false) {
132 }
ext::shared_ptr< QuantLib::YoYInflationCapFloorEngine > yoyInflationCouponPricer_
+ Here is the call graph for this function:

Member Function Documentation

◆ minStrike()

Real minStrike
overridevirtual

Definition at line 144 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

145 {
146 return capFloorPrices_->strikes().front();
147 }

◆ maxStrike()

Real maxStrike
overridevirtual

Definition at line 151 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

152 {
153 return capFloorPrices_->strikes().back();
154 }

◆ maxDate()

Date maxDate
overridevirtual

Definition at line 136 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

137 {
138 Size n = capFloorPrices_->maturities().size();
139 return referenceDate()+capFloorPrices_->maturities()[n-1];
140 }

◆ Dslice()

std::pair< std::vector< Rate >, std::vector< Volatility > > Dslice ( const Date &  d) const

Definition at line 183 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

184 {
185 updateSlice(d);
186 return slice_;
187 }
std::pair< std::vector< Rate >, std::vector< Volatility > > slice_

◆ volatilityImpl() [1/2]

Volatility volatilityImpl ( const Date &  d,
Rate  strike 
) const
protectedvirtual

Definition at line 169 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

170 {
171 updateSlice(d);
172 // patch 1 for QL class:
173 // extrapolation on interpolator (if enabled in this class)
174 if (this->allowsExtrapolation()) {
175 this->tempKinterpolation_.enableExtrapolation();
176 }
177 return tempKinterpolation_(strike);
178 }

◆ volatilityImpl() [2/2]

Volatility volatilityImpl ( Time  length,
Rate  strike 
) const
overrideprotectedvirtual

Definition at line 191 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

192 {
193
194 Natural years = (Natural)floor(length);
195 Natural days = (Natural)floor((length - years) * 365.0);
196 Date d = referenceDate() + Period(years, Years) + Period(days, Days);
197
198 return this->volatilityImpl(d, strike);
199 }
virtual Volatility volatilityImpl(const Date &d, Rate strike) const

◆ performCalculations()

void performCalculations
protectedvirtual

Definition at line 158 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

159 {
160
161 // slope is the assumption on the initial caplet volatility change
164 slope_);
165 }
+ Here is the caller graph for this function:

◆ updateSlice()

void updateSlice ( const Date &  d) const
private

Definition at line 202 of file kinterpolatedyoyoptionletvolatilitysurface.hpp.

203 {
204
205 if (!lastDateisSet_ || d != lastDate_ ) {
206 // patch 2 for QL class:
207 // add observation lag, this is subtracted again in the stripper
208 Date d_eff = d + capFloorPrices_->observationLag();
209 // patch 3 for QL class:
210 // flat extrapolation in date direction, if extrapolation is enabled
211 if (this->allowsExtrapolation())
212 d_eff = std::min(d_eff, maxDate());
213 slice_ = yoyOptionletStripper_->slice(d_eff);
214
216 factory1D_.interpolate( slice_.first.begin(),
217 slice_.first.end(),
218 slice_.second.begin() );
219 lastDateisSet_ = true;
220 lastDate_ = d;
221 }
222 }

Member Data Documentation

◆ capFloorPrices_

ext::shared_ptr<YoYCapFloorTermPriceSurface> capFloorPrices_
protected

◆ yoyInflationCouponPricer_

ext::shared_ptr<QuantLib::YoYInflationCapFloorEngine> yoyInflationCouponPricer_
protected

◆ yoyOptionletStripper_

ext::shared_ptr<YoYOptionletStripper> yoyOptionletStripper_
protected

◆ factory1D_

Interpolator1D factory1D_
mutableprotected

◆ slope_

Real slope_
mutableprotected

◆ lastDateisSet_

bool lastDateisSet_
mutableprotected

◆ lastDate_

Date lastDate_
mutableprotected

◆ tempKinterpolation_

Interpolation tempKinterpolation_
mutableprotected

◆ slice_

std::pair<std::vector<Rate>, std::vector<Volatility> > slice_
mutableprotected