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

Converts a CPIVolatilityStructure with fixed reference date into a floating reference date term structure. More...

#include <qle/termstructures/dynamiccpivolatilitystructure.hpp>

+ Inheritance diagram for DynamicCPIVolatilitySurface:
+ Collaboration diagram for DynamicCPIVolatilitySurface:

Public Member Functions

 DynamicCPIVolatilitySurface (const QuantLib::ext::shared_ptr< CPIVolatilitySurface > &source, ReactionToTimeDecay decayMode=ConstantVariance)
 
- 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

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

Observer interface

const QuantLib::ext::shared_ptr< CPIVolatilitySurfacesource_
 
ReactionToTimeDecay decayMode_
 
const Date originalReferenceDate_
 
void update () override
 

Additional Inherited Members

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

Detailed Description

Converts a CPIVolatilityStructure with fixed reference date into a floating reference date term structure.

Different ways of reacting to time decay can be specified.

Definition at line 41 of file dynamiccpivolatilitystructure.hpp.

Constructor & Destructor Documentation

◆ DynamicCPIVolatilitySurface()

DynamicCPIVolatilitySurface ( const QuantLib::ext::shared_ptr< CPIVolatilitySurface > &  source,
ReactionToTimeDecay  decayMode = ConstantVariance 
)

Definition at line 22 of file dynamiccpivolatilitystructure.cpp.

24 : CPIVolatilitySurface(source->settlementDays(), source->calendar(), source->businessDayConvention(),
25 source->dayCounter(), source->observationLag(), source->frequency(),
26 source->indexIsInterpolated()),
27 source_(source), decayMode_(decayMode), originalReferenceDate_(source->referenceDate()) {
28 // Set extrapolation to source's extrapolation initially
29 enableExtrapolation(source->allowsExtrapolation());
30}
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)
const QuantLib::ext::shared_ptr< CPIVolatilitySurface > source_

Member Function Documentation

◆ volatilityImpl()

Volatility volatilityImpl ( Time  length,
Rate  strike 
) const
overrideprotected

Definition at line 52 of file dynamiccpivolatilitystructure.cpp.

52 {
54 // FIXME!
55 Date m = referenceDate() + int(floor(365.25 * length)) * Days;
56 return source_->volatility(m, strike, source_->observationLag());
57 }
58
59 // TODO: check validity of ForwardVariance option before using it.
61 "ForwardVariance not yet supported for DynamicCPiVolatilityStructure");
62 // if (decayMode_ == ForwardForwardVariance) {
63 // Volatility varToRef = source_->totalVariance(referenceDate(), strike, source_->observationLag());
64 // Volatility varToOptTime = source_->totalVariance(optionDate, strike, source_->observationLag());
65 // return std::sqrt((varToOptTime - varToRef) / timeFromReference(optionDate));
66 // }
67
68 QL_FAIL("Unexpected decay mode (" << decayMode_ << ")");
69}
@ ConstantVariance
@ ForwardForwardVariance

◆ minStrike()

Rate minStrike ( ) const
overrideprotected

Definition at line 32 of file dynamiccpivolatilitystructure.cpp.

32{ return source_->minStrike(); }

◆ maxStrike()

Rate maxStrike ( ) const
overrideprotected

Definition at line 34 of file dynamiccpivolatilitystructure.cpp.

34{ return source_->maxStrike(); }

◆ maxDate()

Date maxDate ( ) const
overrideprotected

Definition at line 36 of file dynamiccpivolatilitystructure.cpp.

36 {
38 return source_->maxDate();
39 }
40
42 return Date(std::min(Date::maxDate().serialNumber(), referenceDate().serialNumber() -
43 originalReferenceDate_.serialNumber() +
44 source_->maxDate().serialNumber()));
45 }
46
47 QL_FAIL("unexpected decay mode (" << decayMode_ << ")");
48}

◆ update()

void update ( )
overrideprotected

Definition at line 50 of file dynamiccpivolatilitystructure.cpp.

50{ TermStructure::update(); }

Member Data Documentation

◆ source_

const QuantLib::ext::shared_ptr<CPIVolatilitySurface> source_
private

Definition at line 69 of file dynamiccpivolatilitystructure.hpp.

◆ decayMode_

ReactionToTimeDecay decayMode_
private

Definition at line 70 of file dynamiccpivolatilitystructure.hpp.

◆ originalReferenceDate_

const Date originalReferenceDate_
private

Definition at line 71 of file dynamiccpivolatilitystructure.hpp.