QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SwaptionVolatilityDiscrete Class Reference

#include <swaptionvoldiscrete.hpp>

+ Inheritance diagram for SwaptionVolatilityDiscrete:
+ Collaboration diagram for SwaptionVolatilityDiscrete:

Public Member Functions

 SwaptionVolatilityDiscrete (const std::vector< Period > &optionTenors, const std::vector< Period > &swapTenors, Natural settlementDays, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc)
 
 SwaptionVolatilityDiscrete (const std::vector< Period > &optionTenors, const std::vector< Period > &swapTenors, const Date &referenceDate, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc)
 
 SwaptionVolatilityDiscrete (const std::vector< Date > &optionDates, const std::vector< Period > &swapTenors, const Date &referenceDate, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc)
 
const std::vector< Period > & optionTenors () const
 
const std::vector< Date > & optionDates () const
 
const std::vector< Time > & optionTimes () const
 
const std::vector< Period > & swapTenors () const
 
const std::vector< Time > & swapLengths () const
 
Observer interface
void update () override
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 
- Public Member Functions inherited from SwaptionVolatilityStructure
 SwaptionVolatilityStructure (BusinessDayConvention bdc, const DayCounter &dc=DayCounter())
 
 SwaptionVolatilityStructure (const Date &referenceDate, const Calendar &calendar, BusinessDayConvention bdc, const DayCounter &dc=DayCounter())
 initialize with a fixed reference date More...
 
 SwaptionVolatilityStructure (Natural settlementDays, const Calendar &, BusinessDayConvention bdc, const DayCounter &dc=DayCounter())
 calculate the reference date based on the global evaluation date More...
 
 ~SwaptionVolatilityStructure () override=default
 
Volatility volatility (const Period &optionTenor, const Period &swapTenor, Rate strike, bool extrapolate=false) const
 returns the volatility for a given option tenor and swap tenor More...
 
Volatility volatility (const Date &optionDate, const Period &swapTenor, Rate strike, bool extrapolate=false) const
 returns the volatility for a given option date and swap tenor More...
 
Volatility volatility (Time optionTime, const Period &swapTenor, Rate strike, bool extrapolate=false) const
 returns the volatility for a given option time and swap tenor More...
 
Volatility volatility (const Period &optionTenor, Time swapLength, Rate strike, bool extrapolate=false) const
 returns the volatility for a given option tenor and swap length More...
 
Volatility volatility (const Date &optionDate, Time swapLength, Rate strike, bool extrapolate=false) const
 returns the volatility for a given option date and swap length More...
 
Volatility volatility (Time optionTime, Time swapLength, Rate strike, bool extrapolate=false) const
 returns the volatility for a given option time and swap length More...
 
Real blackVariance (const Period &optionTenor, const Period &swapTenor, Rate strike, bool extrapolate=false) const
 returns the Black variance for a given option tenor and swap tenor More...
 
Real blackVariance (const Date &optionDate, const Period &swapTenor, Rate strike, bool extrapolate=false) const
 returns the Black variance for a given option date and swap tenor More...
 
Real blackVariance (Time optionTime, const Period &swapTenor, Rate strike, bool extrapolate=false) const
 returns the Black variance for a given option time and swap tenor More...
 
Real blackVariance (const Period &optionTenor, Time swapLength, Rate strike, bool extrapolate=false) const
 returns the Black variance for a given option tenor and swap length More...
 
Real blackVariance (const Date &optionDate, Time swapLength, Rate strike, bool extrapolate=false) const
 returns the Black variance for a given option date and swap length More...
 
Real blackVariance (Time optionTime, Time swapLength, Rate strike, bool extrapolate=false) const
 returns the Black variance for a given option time and swap length More...
 
Real shift (const Period &optionTenor, const Period &swapTenor, bool extrapolate=false) const
 returns the shift for a given option tenor and swap tenor More...
 
Real shift (const Date &optionDate, const Period &swapTenor, bool extrapolate=false) const
 returns the shift for a given option date and swap tenor More...
 
Real shift (Time optionTime, const Period &swapTenor, bool extrapolate=false) const
 returns the shift for a given option time and swap tenor More...
 
Real shift (const Period &optionTenor, Time swapLength, bool extrapolate=false) const
 returns the shift for a given option tenor and swap length More...
 
Real shift (const Date &optionDate, Time swapLength, bool extrapolate=false) const
 returns the shift for a given option date and swap length More...
 
Real shift (Time optionTime, Time swapLength, bool extrapolate=false) const
 returns the shift for a given option time and swap length More...
 
ext::shared_ptr< SmileSectionsmileSection (const Period &optionTenor, const Period &swapTenor, bool extr=false) const
 returns the smile for a given option tenor and swap tenor More...
 
ext::shared_ptr< SmileSectionsmileSection (const Date &optionDate, const Period &swapTenor, bool extr=false) const
 returns the smile for a given option date and swap tenor More...
 
ext::shared_ptr< SmileSectionsmileSection (Time optionTime, const Period &swapTenor, bool extr=false) const
 returns the smile for a given option time and swap tenor More...
 
ext::shared_ptr< SmileSectionsmileSection (const Period &optionTenor, Time swapLength, bool extr=false) const
 returns the smile for a given option tenor and swap length More...
 
ext::shared_ptr< SmileSectionsmileSection (const Date &optionDate, Time swapLength, bool extr=false) const
 returns the smile for a given option date and swap length More...
 
ext::shared_ptr< SmileSectionsmileSection (Time optionTime, Time swapLength, bool extr=false) const
 returns the smile for a given option time and swap length More...
 
virtual const PeriodmaxSwapTenor () const =0
 the largest length for which the term structure can return vols More...
 
Time maxSwapLength () const
 the largest swapLength for which the term structure can return vols More...
 
virtual VolatilityType volatilityType () const
 volatility type More...
 
Time swapLength (const Period &swapTenor) const
 implements the conversion between swap tenor and swap (time) length More...
 
Time swapLength (const Date &start, const Date &end) const
 implements the conversion between swap dates and swap (time) length More...
 
- Public Member Functions inherited from VolatilityTermStructure
 VolatilityTermStructure (BusinessDayConvention bdc, const DayCounter &dc=DayCounter())
 
 VolatilityTermStructure (const Date &referenceDate, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc=DayCounter())
 initialize with a fixed reference date More...
 
 VolatilityTermStructure (Natural settlementDays, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc=DayCounter())
 calculate the reference date based on the global evaluation date More...
 
virtual BusinessDayConvention businessDayConvention () const
 the business day convention used in tenor to date conversion More...
 
Date optionDateFromTenor (const Period &) const
 period/date conversion More...
 
virtual Rate minStrike () const =0
 the minimum strike for which the term structure can return vols More...
 
virtual Rate maxStrike () const =0
 the maximum strike for which the term structure can return vols More...
 
- Public Member Functions inherited from TermStructure
 TermStructure (DayCounter dc=DayCounter())
 default constructor More...
 
 TermStructure (const Date &referenceDate, Calendar calendar=Calendar(), DayCounter dc=DayCounter())
 initialize with a fixed reference date More...
 
 TermStructure (Natural settlementDays, Calendar, DayCounter dc=DayCounter())
 calculate the reference date based on the global evaluation date More...
 
 ~TermStructure () override=default
 
virtual DayCounter dayCounter () const
 the day counter used for date/time conversion More...
 
Time timeFromReference (const Date &date) const
 date/time conversion More...
 
virtual Date maxDate () const =0
 the latest date for which the curve can return values More...
 
virtual Time maxTime () const
 the latest time for which the curve can return values More...
 
virtual const DatereferenceDate () const
 the date at which discount = 1.0 and/or variance = 0.0 More...
 
virtual Calendar calendar () const
 the calendar used for reference and/or option date calculation More...
 
virtual Natural settlementDays () const
 the settlementDays used for reference date calculation More...
 
- Public Member Functions inherited from Extrapolator
 Extrapolator ()=default
 
virtual ~Extrapolator ()=default
 
void enableExtrapolation (bool b=true)
 enable extrapolation in subsequent calls More...
 
void disableExtrapolation (bool b=true)
 disable extrapolation in subsequent calls More...
 
bool allowsExtrapolation () const
 tells whether extrapolation is enabled More...
 

LazyObject interface

Size nOptionTenors_
 
std::vector< PeriodoptionTenors_
 
std::vector< DateoptionDates_
 
std::vector< TimeoptionTimes_
 
Interpolation optionInterpolator_
 
std::vector< RealoptionDatesAsReal_
 
std::vector< TimeoptionInterpolatorTimes_
 
std::vector< RealoptionInterpolatorDatesAsReal_
 
Size nSwapTenors_
 
std::vector< PeriodswapTenors_
 
std::vector< TimeswapLengths_
 
Date cachedReferenceDate_
 
void performCalculations () const override
 
Date optionDateFromTime (Time optionTime) const
 additional inspectors More...
 
void checkOptionTenors () const
 
void checkOptionDates (const Date &reference) const
 
void checkSwapTenors () const
 
void initializeOptionDatesAndTimes () const
 
void initializeOptionTimes () const
 
void initializeSwapLengths () const
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 
- Protected Member Functions inherited from SwaptionVolatilityStructure
virtual ext::shared_ptr< SmileSectionsmileSectionImpl (const Date &optionDate, const Period &swapTenor) const
 
virtual ext::shared_ptr< SmileSectionsmileSectionImpl (Time optionTime, Time swapLength) const =0
 
virtual Volatility volatilityImpl (const Date &optionDate, const Period &swapTenor, Rate strike) const
 
virtual Volatility volatilityImpl (Time optionTime, Time swapLength, Rate strike) const =0
 
virtual Real shiftImpl (const Date &optionDate, const Period &swapTenor) const
 
virtual Real shiftImpl (Time optionTime, Time swapLength) const
 
void checkSwapTenor (const Period &swapTenor, bool extrapolate) const
 
void checkSwapTenor (Time swapLength, bool extrapolate) const
 
- Protected Member Functions inherited from VolatilityTermStructure
void checkStrike (Rate strike, bool extrapolate) const
 strike-range check More...
 
- Protected Member Functions inherited from TermStructure
void checkRange (const Date &d, bool extrapolate) const
 date-range check More...
 
void checkRange (Time t, bool extrapolate) const
 time-range check More...
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 
- Protected Attributes inherited from TermStructure
bool moving_ = false
 
bool updated_ = true
 
Calendar calendar_
 

Detailed Description

Definition at line 33 of file swaptionvoldiscrete.hpp.

Constructor & Destructor Documentation

◆ SwaptionVolatilityDiscrete() [1/3]

SwaptionVolatilityDiscrete ( const std::vector< Period > &  optionTenors,
const std::vector< Period > &  swapTenors,
Natural  settlementDays,
const Calendar cal,
BusinessDayConvention  bdc,
const DayCounter dc 
)

Definition at line 27 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:

◆ SwaptionVolatilityDiscrete() [2/3]

SwaptionVolatilityDiscrete ( const std::vector< Period > &  optionTenors,
const std::vector< Period > &  swapTenors,
const Date referenceDate,
const Calendar cal,
BusinessDayConvention  bdc,
const DayCounter dc 
)

Definition at line 60 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:

◆ SwaptionVolatilityDiscrete() [3/3]

SwaptionVolatilityDiscrete ( const std::vector< Date > &  optionDates,
const std::vector< Period > &  swapTenors,
const Date referenceDate,
const Calendar cal,
BusinessDayConvention  bdc,
const DayCounter dc 
)

Definition at line 92 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ optionTenors()

const std::vector< Period > & optionTenors ( ) const

Definition at line 97 of file swaptionvoldiscrete.hpp.

◆ optionDates()

const std::vector< Date > & optionDates ( ) const

Definition at line 102 of file swaptionvoldiscrete.hpp.

◆ optionTimes()

const std::vector< Time > & optionTimes ( ) const

Definition at line 107 of file swaptionvoldiscrete.hpp.

◆ swapTenors()

const std::vector< Period > & swapTenors ( ) const

Definition at line 112 of file swaptionvoldiscrete.hpp.

◆ swapLengths()

const std::vector< Time > & swapLengths ( ) const

Definition at line 117 of file swaptionvoldiscrete.hpp.

◆ update()

void update ( )
overridevirtual

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Reimplemented from LazyObject.

Definition at line 192 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
overridevirtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Implements LazyObject.

Reimplemented in SwaptionVolatilityMatrix.

Definition at line 180 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ optionDateFromTime()

Date optionDateFromTime ( Time  optionTime) const

additional inspectors

Definition at line 121 of file swaptionvoldiscrete.hpp.

+ Here is the caller graph for this function:

◆ checkOptionTenors()

void checkOptionTenors ( ) const
private

Definition at line 136 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkOptionDates()

void checkOptionDates ( const Date reference) const
private

Definition at line 124 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkSwapTenors()

void checkSwapTenors ( ) const
private

Definition at line 147 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initializeOptionDatesAndTimes()

void initializeOptionDatesAndTimes ( ) const
private

Definition at line 158 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initializeOptionTimes()

void initializeOptionTimes ( ) const
private

Definition at line 168 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initializeSwapLengths()

void initializeSwapLengths ( ) const
private

Definition at line 175 of file swaptionvoldiscrete.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ nOptionTenors_

Size nOptionTenors_
protected

Definition at line 72 of file swaptionvoldiscrete.hpp.

◆ optionTenors_

std::vector<Period> optionTenors_
protected

Definition at line 73 of file swaptionvoldiscrete.hpp.

◆ optionDates_

std::vector<Date> optionDates_
mutableprotected

Definition at line 74 of file swaptionvoldiscrete.hpp.

◆ optionTimes_

std::vector<Time> optionTimes_
mutableprotected

Definition at line 75 of file swaptionvoldiscrete.hpp.

◆ optionInterpolator_

Interpolation optionInterpolator_
mutableprotected

Definition at line 76 of file swaptionvoldiscrete.hpp.

◆ optionDatesAsReal_

std::vector<Real> optionDatesAsReal_
mutableprotected

Definition at line 77 of file swaptionvoldiscrete.hpp.

◆ optionInterpolatorTimes_

std::vector<Time> optionInterpolatorTimes_
mutableprotected

Definition at line 78 of file swaptionvoldiscrete.hpp.

◆ optionInterpolatorDatesAsReal_

std::vector<Real> optionInterpolatorDatesAsReal_
mutableprotected

Definition at line 79 of file swaptionvoldiscrete.hpp.

◆ nSwapTenors_

Size nSwapTenors_
protected

Definition at line 81 of file swaptionvoldiscrete.hpp.

◆ swapTenors_

std::vector<Period> swapTenors_
protected

Definition at line 82 of file swaptionvoldiscrete.hpp.

◆ swapLengths_

std::vector<Time> swapLengths_
mutableprotected

Definition at line 83 of file swaptionvoldiscrete.hpp.

◆ cachedReferenceDate_

Date cachedReferenceDate_
mutableprotected

Definition at line 84 of file swaptionvoldiscrete.hpp.