24#ifndef quantlib_k_interpolated_yoy_optionlet_volatility_surface_hpp
25#define quantlib_k_interpolated_yoy_optionlet_volatility_surface_hpp
45 template<
class Interpolator1D>
57 const ext::shared_ptr<YoYCapFloorTermPriceSurface>& capFloorPrices,
58 ext::shared_ptr<YoYInflationCapFloorEngine> pricer,
59 ext::shared_ptr<YoYOptionletStripper> yoyOptionletStripper,
68 std::pair<std::vector<Rate>, std::vector<Volatility> >
Dslice(
86 mutable std::pair<std::vector<Rate>, std::vector<Volatility> >
slice_;
94 template <
class Interpolator1D>
102 const ext::shared_ptr<YoYCapFloorTermPriceSurface>& capFloorPrices,
103 ext::shared_ptr<YoYInflationCapFloorEngine> pricer,
104 ext::shared_ptr<YoYOptionletStripper> yoyOptionletStripper,
114 capFloorPrices->yoyIndex()->frequency(),
115 capFloorPrices->yoyIndex()->interpolated(),
118 capFloorPrices_(capFloorPrices), yoyInflationCouponPricer_(
std::move(pricer)),
119 yoyOptionletStripper_(
std::move(yoyOptionletStripper)), factory1D_(interpolator),
125 template<
class Interpolator1D>
128 Size n = capFloorPrices_->maturities().size();
129 return referenceDate()+capFloorPrices_->maturities()[
n-1];
133 template<
class Interpolator1D>
136 return capFloorPrices_->strikes().front();
140 template<
class Interpolator1D>
143 return capFloorPrices_->strikes().back();
147 template<
class Interpolator1D>
152 yoyOptionletStripper_->initialize(capFloorPrices_,
153 yoyInflationCouponPricer_,
158 template<
class Interpolator1D>
162 if (this->allowsExtrapolation()) {
163 this->tempKinterpolation_.enableExtrapolation();
165 return tempKinterpolation_(strike);
169 template<
class Interpolator1D>
170 std::pair<std::vector<Rate>, std::vector<Volatility> >
178 template<
class Interpolator1D>
186 return this->volatilityImpl(
d, strike);
189 template<
class Interpolator1D>
193 if (!lastDateisSet_ ||
d != lastDate_ ) {
194 slice_ = yoyOptionletStripper_->slice(
d);
196 tempKinterpolation_ =
197 factory1D_.interpolate( slice_.first.begin(),
199 slice_.second.begin() );
200 lastDateisSet_ =
true;
base class for 1-D interpolations.
K-interpolated YoY optionlet volatility.
virtual Volatility volatilityImpl(const Date &d, Rate strike) const
virtual void performCalculations() const
void updateSlice(const Date &d) const
Real minStrike() const override
the minimum strike for which the term structure can return vols
ext::shared_ptr< YoYOptionletStripper > yoyOptionletStripper_
KInterpolatedYoYOptionletVolatilitySurface(Natural settlementDays, const Calendar &, BusinessDayConvention bdc, const DayCounter &dc, const Period &lag, const ext::shared_ptr< YoYCapFloorTermPriceSurface > &capFloorPrices, ext::shared_ptr< YoYInflationCapFloorEngine > pricer, ext::shared_ptr< YoYOptionletStripper > yoyOptionletStripper, Real slope, const Interpolator1D &interpolator=Interpolator1D(), VolatilityType volType=ShiftedLognormal, Real displacement=0.0)
Interpolation tempKinterpolation_
Date maxDate() const override
the latest date for which the curve can return values
std::pair< std::vector< Rate >, std::vector< Volatility > > slice_
ext::shared_ptr< YoYCapFloorTermPriceSurface > capFloorPrices_
ext::shared_ptr< YoYInflationCapFloorEngine > yoyInflationCouponPricer_
Interpolator1D factory1D_
std::pair< std::vector< Rate >, std::vector< Volatility > > Dslice(const Date &d) const
Real maxStrike() const override
the maximum strike for which the term structure can return vols
virtual Natural settlementDays() const
the settlementDays used for reference date calculation
virtual Real displacement() const
Returns the displacement for lognormal volatilities.
BusinessDayConvention
Business Day conventions.
Real Time
continuous quantity with 1-year units
unsigned QL_INTEGER Natural
positive integer
Real Volatility
volatility
std::size_t Size
size of a container
Real years(const Period &p)
Real days(const Period &p)
yoy inflation-cap stripping