QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
List of all members
TermStructure Class Referenceabstract

Basic term-structure functionality. More...

#include <termstructure.hpp>

+ Inheritance diagram for TermStructure:
+ Collaboration diagram for TermStructure:

Public Member Functions

Constructors

There are three ways in which a term structure can keep track of its reference date. The first is that such date is fixed; the second is that it is determined by advancing the current date of a given number of business days; and the third is that it is based on the reference date of some other structure.

In the first case, the constructor taking a date is to be used; the default implementation of referenceDate() will then return such date. In the second case, the constructor taking a number of days and a calendar is to be used; referenceDate() will return a date calculated based on the current evaluation date, and the term structure and its observers will be notified when the evaluation date changes. In the last case, the referenceDate() method must be overridden in derived classes so that it fetches and return the appropriate date.

 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
 
Dates and Time
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 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 Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- 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...
 

Observer interface

bool moving_ = false
 
bool updated_ = true
 
Calendar calendar_
 
Date referenceDate_
 
Natural settlementDays_
 
DayCounter dayCounter_
 
void update () override
 
void checkRange (const Date &d, bool extrapolate) const
 date-range check More...
 
void checkRange (Time t, bool extrapolate) const
 time-range check More...
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 

Detailed Description

Basic term-structure functionality.

Definition at line 37 of file termstructure.hpp.

Constructor & Destructor Documentation

◆ TermStructure() [1/3]

TermStructure ( DayCounter  dc = DayCounter())
explicit

default constructor

Warning:
term structures initialized by means of this constructor must manage their own reference date by overriding the referenceDate() method.

Definition at line 26 of file termstructure.cpp.

◆ TermStructure() [2/3]

TermStructure ( const Date referenceDate,
Calendar  calendar = Calendar(),
DayCounter  dc = DayCounter() 
)
explicit

initialize with a fixed reference date

Definition at line 29 of file termstructure.cpp.

◆ TermStructure() [3/3]

TermStructure ( Natural  settlementDays,
Calendar  cal,
DayCounter  dc = DayCounter() 
)

calculate the reference date based on the global evaluation date

Definition at line 33 of file termstructure.cpp.

+ Here is the call graph for this function:

◆ ~TermStructure()

~TermStructure ( )
overridedefault

Member Function Documentation

◆ dayCounter()

DayCounter dayCounter ( ) const
virtual

◆ timeFromReference()

Time timeFromReference ( const Date date) const

date/time conversion

Definition at line 133 of file termstructure.hpp.

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

◆ maxDate()

virtual Date maxDate ( ) const
pure virtual

the latest date for which the curve can return values

Implemented in TenorOptionletVTS, TenorSwaptionVTS, CallableBondConstantVolatility, CommodityCurve, BaseCorrelationTermStructure< Interpolator2D_T >, FactorSpreadedHazardRateCurve, InterpolatedAffineHazardRateCurve< Interpolator >, OneFactorAffineSurvivalStructure, SpreadedHazardRateCurve, CPICapFloorTermPriceSurface, KInterpolatedYoYOptionletVolatilitySurface< Interpolator1D >, PiecewiseYoYOptionletVolatilityCurve< Interpolator, Bootstrap, Traits >, InterpolatedYoYCapFloorTermPriceSurface< Interpolator2D, Interpolator1D >, InterpolatedYoYOptionletVolatilityCurve< Interpolator1D >, InterpolatedYoYOptionletVolatilityCurve< Interpolator >, AbcdAtmVolCurve, ExtendedBlackVarianceCurve, ExtendedBlackVarianceSurface, SabrVolSurface, SABRVolTermStructure, FdmAffineModelTermStructure, FlatHazardRate, InterpolatedDefaultDensityCurve< Interpolator >, InterpolatedHazardRateCurve< Interpolator >, InterpolatedSurvivalProbabilityCurve< Interpolator >, InterpolatedYoYInflationCurve< Interpolator >, InterpolatedZeroInflationCurve< Interpolator >, PiecewiseYoYInflationCurve< Interpolator, Bootstrap, Traits >, PiecewiseZeroInflationCurve< Interpolator, Bootstrap, Traits >, CapFloorTermVolCurve, CapFloorTermVolSurface, ConstantCapFloorTermVolatility, AndreasenHugeLocalVolAdapter, AndreasenHugeVolatilityAdapter, BlackConstantVol, BlackVarianceCurve, BlackVarianceSurface, FixedLocalVolSurface, GridModelLocalVolSurface, HestonBlackVolSurface, ImpliedVolTermStructure, LocalConstantVol, LocalVolCurve, LocalVolSurface, ConstantCPIVolatility, ConstantYoYOptionletVolatility, CapletVarianceCurve, ConstantOptionletVolatility, SpreadedOptionletVolatility, StrippedOptionletAdapter, Gaussian1dSwaptionVolatility, SpreadedSwaptionVolatility, ConstantSwaptionVolatility, SwaptionVolatilityCube, SwaptionVolatilityMatrix, CompositeZeroYieldStructure< BinaryFunction >, InterpolatedDiscountCurve< Interpolator >, FittedBondDiscountCurve, FlatForward, InterpolatedForwardCurve< Interpolator >, ForwardSpreadedTermStructure, ImpliedTermStructure, InterpolatedSimpleZeroCurve< Interpolator >, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, QuantoTermStructure, UltimateForwardTermStructure, InterpolatedZeroCurve< Interpolator >, and ZeroSpreadedTermStructure.

+ Here is the caller graph for this function:

◆ maxTime()

Time maxTime ( ) const
virtual

the latest time for which the curve can return values

Reimplemented in FactorSpreadedHazardRateCurve, SpreadedHazardRateCurve, SabrVolSurface, FixedLocalVolSurface, GridModelLocalVolSurface, SpreadedOptionletVolatility, SpreadedSwaptionVolatility, SwaptionVolatilityCube, CompositeZeroYieldStructure< BinaryFunction >, ForwardSpreadedTermStructure, and ZeroSpreadedTermStructure.

Definition at line 119 of file termstructure.hpp.

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

◆ referenceDate()

const Date & referenceDate ( ) const
virtual

◆ calendar()

Calendar calendar ( ) const
virtual

◆ settlementDays()

Natural settlementDays ( ) const
virtual

◆ 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.

Implements Observer.

Reimplemented in DefaultProbabilityTermStructure, PiecewiseYoYInflationCurve< Interpolator, Bootstrap, Traits >, PiecewiseZeroInflationCurve< Interpolator, Bootstrap, Traits >, CapFloorTermVolCurve, CapFloorTermVolSurface, GridModelLocalVolSurface, StrippedOptionletAdapter, SwaptionVolatilityDiscrete, CompositeZeroYieldStructure< BinaryFunction >, FittedBondDiscountCurve, FlatForward, ForwardSpreadedTermStructure, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, UltimateForwardTermStructure, ZeroSpreadedTermStructure, and YieldTermStructure.

Definition at line 48 of file termstructure.cpp.

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

◆ checkRange() [1/2]

void checkRange ( const Date d,
bool  extrapolate 
) const
protected

date-range check

Definition at line 54 of file termstructure.cpp.

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

◆ checkRange() [2/2]

void checkRange ( Time  t,
bool  extrapolate 
) const
protected

time-range check

Definition at line 64 of file termstructure.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ moving_

bool moving_ = false
protected

Definition at line 104 of file termstructure.hpp.

◆ updated_

bool updated_ = true
mutableprotected

Definition at line 105 of file termstructure.hpp.

◆ calendar_

Calendar calendar_
protected

Definition at line 106 of file termstructure.hpp.

◆ referenceDate_

Date referenceDate_
mutableprivate

Definition at line 108 of file termstructure.hpp.

◆ settlementDays_

Natural settlementDays_
private

Definition at line 109 of file termstructure.hpp.

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 110 of file termstructure.hpp.