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
DynamicYoYOptionletVolatilitySurface Class Reference

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

#include <qle/termstructures/dynamicyoyoptionletvolatilitystructure.hpp>

+ Inheritance diagram for DynamicYoYOptionletVolatilitySurface:
+ Collaboration diagram for DynamicYoYOptionletVolatilitySurface:

Public Member Functions

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

Protected Member Functions

Volatility volatilityImpl (Time optionTime, Rate strike) const override
 
Rate minStrike () const override
 
Rate maxStrike () const override
 
Date maxDate () const override
 

Private Attributes

const QuantLib::ext::shared_ptr< YoYOptionletVolatilitySurfacesource_
 
ReactionToTimeDecay decayMode_
 
const Date originalReferenceDate_
 

Detailed Description

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

Different ways of reacting to time decay can be specified.

Warning:
No checks are performed that the supplied YoYOptionletVolatilitySurface has a fixed reference date

Definition at line 42 of file dynamicyoyoptionletvolatilitystructure.hpp.

Constructor & Destructor Documentation

◆ DynamicYoYOptionletVolatilitySurface()

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

Definition at line 22 of file dynamicyoyoptionletvolatilitystructure.cpp.

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

Member Function Documentation

◆ volatilityImpl()

Volatility volatilityImpl ( Time  optionTime,
Rate  strike 
) const
overrideprotected

Definition at line 50 of file dynamicyoyoptionletvolatilitystructure.cpp.

50 {
52 return source_->volatility(optionTime, strike);
53 }
54
55 // TODO: check validity of ForwardVariance option before using it.
57 "ForwardVariance not yet supported for DynamicYoYOptionletVolatilityStructure");
59 // FIXME
60 Real t0 = timeFromBase(referenceDate());
61 Volatility varToRef = source_->volatility(t0, strike) * source_->volatility(t0, strike) * t0;
62 Volatility varToOptTime =
63 source_->volatility(optionTime, strike) * source_->volatility(optionTime, strike) * optionTime;
64 return std::sqrt((varToOptTime - varToRef) / (optionTime - t0));
65 }
66
67 QL_FAIL("Unexpected decay mode (" << decayMode_ << ")");
68}
@ ConstantVariance
@ ForwardForwardVariance

◆ minStrike()

Rate minStrike ( ) const
overrideprotected

Definition at line 32 of file dynamicyoyoptionletvolatilitystructure.cpp.

32{ return source_->minStrike(); }

◆ maxStrike()

Rate maxStrike ( ) const
overrideprotected

Definition at line 34 of file dynamicyoyoptionletvolatilitystructure.cpp.

34{ return source_->maxStrike(); }

◆ maxDate()

Date maxDate ( ) const
overrideprotected

Definition at line 36 of file dynamicyoyoptionletvolatilitystructure.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}

Member Data Documentation

◆ source_

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

Definition at line 54 of file dynamicyoyoptionletvolatilitystructure.hpp.

◆ decayMode_

ReactionToTimeDecay decayMode_
private

Definition at line 55 of file dynamicyoyoptionletvolatilitystructure.hpp.

◆ originalReferenceDate_

const Date originalReferenceDate_
private

Definition at line 56 of file dynamicyoyoptionletvolatilitystructure.hpp.