Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
StrippedYoYInflationOptionletVol Class Reference

#include <qle/termstructures/strippedyoyinflationoptionletvol.hpp>

+ Inheritance diagram for StrippedYoYInflationOptionletVol:
+ Collaboration diagram for StrippedYoYInflationOptionletVol:

Public Member Functions

 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)
 
QuantLib::Date maxDate () const override
 
void performCalculations () const override
 
void update () override
 
const std::vector< Rate > & yoyoptionletStrikes (Size i) const
 
const std::vector< Volatility > & yoyoptionletVolatilities (Size i) const
 
const std::vector< Date > & yoyoptionletFixingDates () const
 
const std::vector< Time > & yoyoptionletFixingTimes () const
 
DayCounter dayCounter () const override
 
Calendar calendar () const override
 
Natural settlementDays () const override
 
BusinessDayConvention businessDayConvention () const override
 
QuantLib::VolatilityType volatilityType () const override
 
QuantLib::Real displacement () const override
 

Protected Member Functions

QuantLib::Rate minStrike () const override
 
QuantLib::Rate maxStrike () const override
 
QuantLib::Volatility volatilityImpl (Time length, QuantLib::Rate strike) const override
 

Private Member Functions

void checkInputs () const
 
void registerWithMarketData ()
 

Private Attributes

Calendar calendar_
 
Natural settlementDays_
 
BusinessDayConvention businessDayConvention_
 
DayCounter dc_
 
VolatilityType type_
 
Real displacement_
 
Size nYoYOptionletDates_
 
std::vector< Date > yoyoptionletDates_
 
std::vector< Time > yoyoptionletTimes_
 
std::vector< std::vector< Rate > > yoyoptionletStrikes_
 
Size nStrikes_
 
std::vector< std::vector< Handle< Quote > > > yoyoptionletVolQuotes_
 
std::vector< std::vector< Volatility > > yoyoptionletVolatilities_
 

Detailed Description

Helper class to wrap in a YoYOptionletVolatilitySurface object.

Definition at line 38 of file strippedyoyinflationoptionletvol.hpp.

Constructor & Destructor Documentation

◆ StrippedYoYInflationOptionletVol()

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 
)

Definition at line 32 of file strippedyoyinflationoptionletvol.cpp.

37 : YoYOptionletVolatilitySurface(settlementDays, calendar, bdc, dc, observationLag, frequency, indexIsInterpolated),
39 displacement_(displacement), nYoYOptionletDates_(yoyoptionletDates.size()), yoyoptionletDates_(yoyoptionletDates),
43
45 registerWith(Settings::instance().evaluationDate());
47
48 for (Size i = 0; i < nYoYOptionletDates_; ++i)
49 yoyoptionletTimes_[i] = dc_.yearFraction(Settings::instance().evaluationDate(), yoyoptionletDates_[i]);
50}
std::vector< std::vector< Volatility > > yoyoptionletVolatilities_
std::vector< std::vector< Handle< Quote > > > yoyoptionletVolQuotes_
vector< Real > strikes
+ Here is the call graph for this function:

Member Function Documentation

◆ maxDate()

Date maxDate ( ) const
override

Definition at line 114 of file strippedyoyinflationoptionletvol.cpp.

114{ return yoyoptionletFixingDates().back(); }
+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
override

Definition at line 104 of file strippedyoyinflationoptionletvol.cpp.

104 {
105 for (Size i = 0; i < nYoYOptionletDates_; ++i)
106 for (Size j = 0; j < nStrikes_; ++j)
108}

◆ update()

void update ( )
override

Definition at line 90 of file strippedyoyinflationoptionletvol.hpp.

90 {
91 TermStructure::update();
92 LazyObject::update();
93}

◆ yoyoptionletStrikes()

const vector< Rate > & yoyoptionletStrikes ( Size  i) const

Definition at line 116 of file strippedyoyinflationoptionletvol.cpp.

116 {
117 QL_REQUIRE(i < yoyoptionletStrikes_.size(), "index (" << i << ") must be less than yoyoptionletStrikes size ("
118 << yoyoptionletStrikes_.size() << ")");
119 return yoyoptionletStrikes_[i];
120}
+ Here is the caller graph for this function:

◆ yoyoptionletVolatilities()

const vector< Volatility > & yoyoptionletVolatilities ( Size  i) const

Definition at line 122 of file strippedyoyinflationoptionletvol.cpp.

122 {
123 QL_REQUIRE(i < yoyoptionletVolatilities_.size(), "index (" << i
124 << ") must be less than yoyoptionletVolatilities size ("
125 << yoyoptionletVolatilities_.size() << ")");
127}
+ Here is the caller graph for this function:

◆ yoyoptionletFixingDates()

const vector< Date > & yoyoptionletFixingDates ( ) const

Definition at line 129 of file strippedyoyinflationoptionletvol.cpp.

129{ return yoyoptionletDates_; }
+ Here is the caller graph for this function:

◆ yoyoptionletFixingTimes()

const vector< Time > & yoyoptionletFixingTimes ( ) const

Definition at line 131 of file strippedyoyinflationoptionletvol.cpp.

131{ return yoyoptionletTimes_; }
+ Here is the caller graph for this function:

◆ dayCounter()

DayCounter dayCounter ( ) const
override

Definition at line 133 of file strippedyoyinflationoptionletvol.cpp.

133{ return dc_; }

◆ calendar()

Calendar calendar ( ) const
override

Definition at line 135 of file strippedyoyinflationoptionletvol.cpp.

135{ return calendar_; }

◆ settlementDays()

Natural settlementDays ( ) const
override

Definition at line 137 of file strippedyoyinflationoptionletvol.cpp.

137{ return settlementDays_; }

◆ businessDayConvention()

BusinessDayConvention businessDayConvention ( ) const
override

Definition at line 139 of file strippedyoyinflationoptionletvol.cpp.

139{ return businessDayConvention_; }

◆ volatilityType()

VolatilityType volatilityType ( ) const
override

Definition at line 141 of file strippedyoyinflationoptionletvol.cpp.

141{ return type_; }

◆ displacement()

Real displacement ( ) const
override

Definition at line 143 of file strippedyoyinflationoptionletvol.cpp.

143{ return displacement_; }

◆ minStrike()

Rate minStrike ( ) const
overrideprotected

Definition at line 110 of file strippedyoyinflationoptionletvol.cpp.

110{ return yoyoptionletStrikes(0).front(); }
const std::vector< Rate > & yoyoptionletStrikes(Size i) const
+ Here is the call graph for this function:

◆ maxStrike()

Rate maxStrike ( ) const
overrideprotected

Definition at line 112 of file strippedyoyinflationoptionletvol.cpp.

112{ return yoyoptionletStrikes(0).back(); }
+ Here is the call graph for this function:

◆ volatilityImpl()

Volatility volatilityImpl ( Time  length,
QuantLib::Rate  strike 
) const
overrideprotected

Definition at line 85 of file strippedyoyinflationoptionletvol.cpp.

85 {
86 calculate();
87
88 std::vector<Volatility> vol(nYoYOptionletDates_);
89 for (Size i = 0; i < nYoYOptionletDates_; ++i) {
91 const std::vector<Volatility>& yoyoptionletVolatilities =
93 QuantLib::ext::shared_ptr<LinearInterpolation> tmp(new LinearInterpolation(
95 vol[i] = tmp->operator()(strike, true);
96 }
97
98 const std::vector<Time>& yoyoptionletTimes = yoyoptionletFixingTimes();
99 QuantLib::ext::shared_ptr<LinearInterpolation> timeVolInterpolator(
100 new LinearInterpolation(yoyoptionletTimes.begin(), yoyoptionletTimes.end(), vol.begin()));
101 return timeVolInterpolator->operator()(length, true);
102}
const std::vector< Volatility > & yoyoptionletVolatilities(Size i) const
+ Here is the call graph for this function:

◆ checkInputs()

void checkInputs ( ) const
private

Definition at line 52 of file strippedyoyinflationoptionletvol.cpp.

52 {
53 if (type_ == Normal) {
54 QL_REQUIRE(displacement_ == 0.0, "non-null displacement is not allowed with Normal model");
55 }
56
57 QL_REQUIRE(!yoyoptionletDates_.empty(), "empty yoy optionlet tenor vector");
58 QL_REQUIRE(nYoYOptionletDates_ == yoyoptionletVolQuotes_.size(), "mismatch between number of option tenors ("
60 << ") and number of volatility rows ("
61 << yoyoptionletVolQuotes_.size() << ")");
62 QL_REQUIRE(yoyoptionletDates_[0] > Settings::instance().evaluationDate(),
63 "first option date (" << yoyoptionletDates_[0] << ") is in the past");
64 for (Size i = 1; i < nYoYOptionletDates_; ++i)
65 QL_REQUIRE(yoyoptionletDates_[i] > yoyoptionletDates_[i - 1],
66 "non increasing option dates: " << io::ordinal(i) << " is " << yoyoptionletDates_[i - 1] << ", "
67 << io::ordinal(i + 1) << " is " << yoyoptionletDates_[i]);
68
69 QL_REQUIRE(nStrikes_ == yoyoptionletVolQuotes_[0].size(),
70 "mismatch between strikes(" << yoyoptionletStrikes_[0].size() << ") and vol columns ("
71 << yoyoptionletVolQuotes_[0].size() << ")");
72 for (Size j = 1; j < nStrikes_; ++j)
73 QL_REQUIRE(yoyoptionletStrikes_[0][j - 1] < yoyoptionletStrikes_[0][j],
74 "non increasing strikes: " << io::ordinal(j) << " is " << io::rate(yoyoptionletStrikes_[0][j - 1])
75 << ", " << io::ordinal(j + 1) << " is "
76 << io::rate(yoyoptionletStrikes_[0][j]));
77}
+ Here is the caller graph for this function:

◆ registerWithMarketData()

void registerWithMarketData ( )
private

Definition at line 79 of file strippedyoyinflationoptionletvol.cpp.

79 {
80 for (Size i = 0; i < nYoYOptionletDates_; ++i)
81 for (Size j = 0; j < nStrikes_; ++j)
82 registerWith(yoyoptionletVolQuotes_[i][j]);
83}
+ Here is the caller graph for this function:

Member Data Documentation

◆ calendar_

Calendar calendar_
private

Definition at line 73 of file strippedyoyinflationoptionletvol.hpp.

◆ settlementDays_

Natural settlementDays_
private

Definition at line 74 of file strippedyoyinflationoptionletvol.hpp.

◆ businessDayConvention_

BusinessDayConvention businessDayConvention_
private

Definition at line 75 of file strippedyoyinflationoptionletvol.hpp.

◆ dc_

DayCounter dc_
private

Definition at line 76 of file strippedyoyinflationoptionletvol.hpp.

◆ type_

VolatilityType type_
private

Definition at line 77 of file strippedyoyinflationoptionletvol.hpp.

◆ displacement_

Real displacement_
private

Definition at line 78 of file strippedyoyinflationoptionletvol.hpp.

◆ nYoYOptionletDates_

Size nYoYOptionletDates_
private

Definition at line 80 of file strippedyoyinflationoptionletvol.hpp.

◆ yoyoptionletDates_

std::vector<Date> yoyoptionletDates_
private

Definition at line 81 of file strippedyoyinflationoptionletvol.hpp.

◆ yoyoptionletTimes_

std::vector<Time> yoyoptionletTimes_
private

Definition at line 82 of file strippedyoyinflationoptionletvol.hpp.

◆ yoyoptionletStrikes_

std::vector<std::vector<Rate> > yoyoptionletStrikes_
private

Definition at line 83 of file strippedyoyinflationoptionletvol.hpp.

◆ nStrikes_

Size nStrikes_
private

Definition at line 84 of file strippedyoyinflationoptionletvol.hpp.

◆ yoyoptionletVolQuotes_

std::vector<std::vector<Handle<Quote> > > yoyoptionletVolQuotes_
private

Definition at line 86 of file strippedyoyinflationoptionletvol.hpp.

◆ yoyoptionletVolatilities_

std::vector<std::vector<Volatility> > yoyoptionletVolatilities_
mutableprivate

Definition at line 87 of file strippedyoyinflationoptionletvol.hpp.