22#include <ql/math/interpolations/cubicinterpolation.hpp>
23#include <ql/math/interpolations/linearinterpolation.hpp>
24#include <ql/math/interpolations/sabrinterpolation.hpp>
25#include <ql/termstructures/volatility/interpolatedsmilesection.hpp>
33 Natural settlementDays,
const Calendar& calendar, BusinessDayConvention bdc,
const DayCounter& dc,
34 const Period& observationLag, Frequency frequency,
bool indexIsInterpolated,
35 const std::vector<Date>& yoyoptionletDates,
const std::vector<Rate>&
strikes,
36 const std::vector<std::vector<Handle<Quote> > >& v, VolatilityType type, Real displacement)
37 : YoYOptionletVolatilitySurface(settlementDays, calendar, bdc, dc, observationLag, frequency, indexIsInterpolated),
38 calendar_(calendar), settlementDays_(settlementDays), businessDayConvention_(bdc), dc_(dc), type_(type),
39 displacement_(displacement), nYoYOptionletDates_(yoyoptionletDates.size()), yoyoptionletDates_(yoyoptionletDates),
40 yoyoptionletTimes_(nYoYOptionletDates_), yoyoptionletStrikes_(nYoYOptionletDates_,
strikes),
41 nStrikes_(
strikes.size()), yoyoptionletVolQuotes_(v),
42 yoyoptionletVolatilities_(nYoYOptionletDates_, vector<Volatility>(nStrikes_)) {
45 registerWith(Settings::instance().evaluationDate());
53 if (
type_ == Normal) {
54 QL_REQUIRE(
displacement_ == 0.0,
"non-null displacement is not allowed with Normal model");
60 <<
") and number of volatility rows ("
66 "non increasing option dates: " << io::ordinal(i) <<
" is " <<
yoyoptionletDates_[i - 1] <<
", "
74 "non increasing strikes: " << io::ordinal(j) <<
" is " << io::rate(
yoyoptionletStrikes_[0][j - 1])
75 <<
", " << io::ordinal(j + 1) <<
" is "
93 QuantLib::ext::shared_ptr<LinearInterpolation> tmp(
new LinearInterpolation(
95 vol[i] = tmp->operator()(strike,
true);
99 QuantLib::ext::shared_ptr<LinearInterpolation> timeVolInterpolator(
100 new LinearInterpolation(yoyoptionletTimes.begin(), yoyoptionletTimes.end(), vol.begin()));
101 return timeVolInterpolator->operator()(length,
true);
117 QL_REQUIRE(i <
yoyoptionletStrikes_.size(),
"index (" << i <<
") must be less than yoyoptionletStrikes size ("
124 <<
") must be less than yoyoptionletVolatilities size ("
void registerWithMarketData()
QuantLib::Volatility volatilityImpl(Time length, QuantLib::Rate strike) const override
void performCalculations() const override
Calendar calendar() const override
std::vector< Date > yoyoptionletDates_
QuantLib::Rate maxStrike() const override
QuantLib::Rate minStrike() const override
const std::vector< Time > & yoyoptionletFixingTimes() const
const std::vector< Volatility > & yoyoptionletVolatilities(Size i) const
const std::vector< Date > & yoyoptionletFixingDates() const
QuantLib::VolatilityType volatilityType() const override
Natural settlementDays() const override
DayCounter dayCounter() const override
QuantLib::Date maxDate() const override
const std::vector< Rate > & yoyoptionletStrikes(Size i) const
std::vector< Time > yoyoptionletTimes_
BusinessDayConvention businessDayConvention() const override
QuantLib::Real displacement() const override
std::vector< std::vector< Volatility > > yoyoptionletVolatilities_
std::vector< std::vector< Handle< Quote > > > yoyoptionletVolQuotes_
std::vector< std::vector< Rate > > yoyoptionletStrikes_
StrippedYoYInflationOptionletVol(Natural settlementDays, const Calendar &calendar, BusinessDayConvention bdc, const DayCounter &dc, const Period &observationLag, Frequency frequency, bool indexIsInterpolated, const std::vector< Date > &yoyoptionletDates, const std::vector< Rate > &strikes, const std::vector< std::vector< Handle< Quote > > > &, VolatilityType type=ShiftedLognormal, Real displacement=0.0)
BusinessDayConvention businessDayConvention_
Stripped YoYInfaltion Optionlet Vol Adapter (with a deeper update method, linear interpolation and op...