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

#include <qle/termstructures/spreadedcpivolatilitysurface.hpp>

+ Inheritance diagram for SpreadedCPIVolatilitySurface:
+ Collaboration diagram for SpreadedCPIVolatilitySurface:

Public Member Functions

 SpreadedCPIVolatilitySurface (const Handle< QuantExt::CPIVolatilitySurface > &baseVol, const std::vector< Date > &optionDates, const std::vector< Real > &strikes, const std::vector< std::vector< Handle< Quote > > > &volSpreads)
 
Rate minStrike () const override
 
Rate maxStrike () const override
 
Date maxDate () const override
 
Time maxTime () const override
 
const Date & referenceDate () const override
 
void update () override
 
void deepUpdate () override
 
QuantLib::Real atmStrike (const QuantLib::Date &maturity, const QuantLib::Period &obsLag=QuantLib::Period(-1, QuantLib::Days)) const override
 
- Public Member Functions inherited from CPIVolatilitySurface
 CPIVolatilitySurface (QuantLib::Natural settlementDays, const QuantLib::Calendar &, QuantLib::BusinessDayConvention bdc, const QuantLib::DayCounter &dc, const QuantLib::Period &observationLag, QuantLib::Frequency frequency, bool indexIsInterpolated, const QuantLib::Date &capFloorStartDate=QuantLib::Date(), QuantLib::VolatilityType volType=QuantLib::ShiftedLognormal, double displacement=0.0)
 
QuantLib::Date optionDateFromTenor (const QuantLib::Period &tenor) const override
 Computes the expiry date from the capFloorStartDate() More...
 
QuantLib::Date baseDate () const override
 base date will be in the past More...
 
QuantLib::VolatilityType volatilityType () const
 Returns the volatility type. More...
 
double displacement () const
 Returns the displacement for lognormal volatilities. More...
 
bool isLogNormal () const
 
QuantLib::Volatility volatility (const QuantLib::Date &maturityDate, QuantLib::Rate strike, const QuantLib::Period &obsLag=QuantLib::Period(-1, QuantLib::Days), bool extrapolate=false) const override
 
virtual QuantLib::Real atmStrike (const QuantLib::Date &maturity, const QuantLib::Period &obsLag=QuantLib::Period(-1, QuantLib::Days)) const =0
 
QuantLib::Date capFloorStartDate () const
 

Protected Member Functions

Volatility volatilityImpl (Time length, Rate strike) const override
 
void performCalculations () const override
 
- Protected Member Functions inherited from CPIVolatilitySurface
virtual double fixingTime (const QuantLib::Date &maturityDate) const
 Computes the expiry time from the capFloorStartDate() More...
 

Private Attributes

Handle< QuantExt::CPIVolatilitySurfacebaseVol_
 
std::vector< Date > optionDates_
 
std::vector< Real > strikes_
 
std::vector< std::vector< Handle< Quote > > > volSpreads_
 
std::vector< Real > optionTimes_
 
Matrix volSpreadValues_
 
Interpolation2D volSpreadInterpolation_
 

Additional Inherited Members

- Protected Attributes inherited from CPIVolatilitySurface
QuantLib::VolatilityType volType_
 
double displacement_
 

Detailed Description

Definition at line 36 of file spreadedcpivolatilitysurface.hpp.

Constructor & Destructor Documentation

◆ SpreadedCPIVolatilitySurface()

SpreadedCPIVolatilitySurface ( const Handle< QuantExt::CPIVolatilitySurface > &  baseVol,
const std::vector< Date > &  optionDates,
const std::vector< Real > &  strikes,
const std::vector< std::vector< Handle< Quote > > > &  volSpreads 
)

Definition at line 28 of file spreadedcpivolatilitysurface.cpp.

32 : QuantExt::CPIVolatilitySurface(baseVol->settlementDays(), baseVol->calendar(), baseVol->businessDayConvention(),
33 baseVol->dayCounter(), baseVol->observationLag(), baseVol->frequency(),
34 baseVol->indexIsInterpolated(), baseVol->capFloorStartDate(),
35 baseVol->volatilityType(), baseVol->displacement()),
36 baseVol_(baseVol), optionDates_(optionDates), strikes_(strikes), volSpreads_(volSpreads) {
37 registerWith(baseVol_);
38 optionTimes_.resize(optionDates_.size());
39 volSpreadValues_ = Matrix(strikes_.size(), optionDates_.size());
40 for (auto const& v : volSpreads)
41 for (auto const& q : v)
42 registerWith(q);
43}
Handle< QuantExt::CPIVolatilitySurface > baseVol_
std::vector< std::vector< Handle< Quote > > > volSpreads_
vector< Real > strikes

Member Function Documentation

◆ minStrike()

Rate minStrike ( ) const
override

Definition at line 48 of file spreadedcpivolatilitysurface.cpp.

48{ return baseVol_->minStrike(); }

◆ maxStrike()

Rate maxStrike ( ) const
override

Definition at line 49 of file spreadedcpivolatilitysurface.cpp.

49{ return baseVol_->maxStrike(); }

◆ maxDate()

Date maxDate ( ) const
override

Definition at line 45 of file spreadedcpivolatilitysurface.cpp.

45{ return baseVol_->maxDate(); }

◆ maxTime()

Time maxTime ( ) const
override

Definition at line 46 of file spreadedcpivolatilitysurface.cpp.

46{ return baseVol_->maxTime(); }

◆ referenceDate()

const Date & referenceDate ( ) const
override

Definition at line 47 of file spreadedcpivolatilitysurface.cpp.

47{ return baseVol_->referenceDate(); }

◆ update()

void update ( )
override

Definition at line 70 of file spreadedcpivolatilitysurface.cpp.

70 {
71 CPIVolatilitySurface::update();
72 LazyObject::update();
73}
+ Here is the caller graph for this function:

◆ deepUpdate()

void deepUpdate ( )
override

Definition at line 75 of file spreadedcpivolatilitysurface.cpp.

75 {
76 baseVol_->update();
77 update();
78}
+ Here is the call graph for this function:

◆ atmStrike()

QuantLib::Real atmStrike ( const QuantLib::Date &  maturity,
const QuantLib::Period &  obsLag = QuantLib::Period(-1, QuantLib::Days) 
) const
overridevirtual

Implements CPIVolatilitySurface.

Definition at line 80 of file spreadedcpivolatilitysurface.cpp.

81 {
82 // Not relevant for constantCPIVolatiltiy;
83 return baseVol_->atmStrike(maturity, obsLag);
84};

◆ volatilityImpl()

Volatility volatilityImpl ( Time  length,
Rate  strike 
) const
overrideprotected

Definition at line 51 of file spreadedcpivolatilitysurface.cpp.

51 {
52 calculate();
53 return baseVol_->volatility(length, strike) + volSpreadInterpolation_(length, strike);
54}

◆ performCalculations()

void performCalculations ( ) const
overrideprotected

Definition at line 56 of file spreadedcpivolatilitysurface.cpp.

56 {
57 for (Size i = 0; i < optionDates_.size(); ++i) {
59 }
60 for (Size k = 0; k < strikes_.size(); ++k) {
61 for (Size i = 0; i < optionDates_.size(); ++i) {
62 volSpreadValues_(k, i) = volSpreads_[i][k]->value();
63 }
64 }
65 volSpreadInterpolation_ = FlatExtrapolator2D(QuantLib::ext::make_shared<BilinearInterpolation>(
66 optionTimes_.begin(), optionTimes_.end(), strikes_.begin(), strikes_.end(), volSpreadValues_));
67 volSpreadInterpolation_.enableExtrapolation();
68}
virtual double fixingTime(const QuantLib::Date &maturityDate) const
Computes the expiry time from the capFloorStartDate()
+ Here is the call graph for this function:

Member Data Documentation

◆ baseVol_

Handle<QuantExt::CPIVolatilitySurface> baseVol_
private

Definition at line 58 of file spreadedcpivolatilitysurface.hpp.

◆ optionDates_

std::vector<Date> optionDates_
private

Definition at line 59 of file spreadedcpivolatilitysurface.hpp.

◆ strikes_

std::vector<Real> strikes_
private

Definition at line 60 of file spreadedcpivolatilitysurface.hpp.

◆ volSpreads_

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

Definition at line 61 of file spreadedcpivolatilitysurface.hpp.

◆ optionTimes_

std::vector<Real> optionTimes_
mutableprivate

Definition at line 63 of file spreadedcpivolatilitysurface.hpp.

◆ volSpreadValues_

Matrix volSpreadValues_
mutableprivate

Definition at line 64 of file spreadedcpivolatilitysurface.hpp.

◆ volSpreadInterpolation_

Interpolation2D volSpreadInterpolation_
mutableprivate

Definition at line 65 of file spreadedcpivolatilitysurface.hpp.