QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Basic term-structure functionality. More...
#include <termstructure.hpp>
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 Date & | referenceDate () 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 &) | |
Observer & | operator= (const Observer &) |
virtual | ~Observer () |
std::pair< iterator, bool > | registerWith (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 &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (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 |
Basic term-structure functionality.
Definition at line 37 of file termstructure.hpp.
|
explicit |
default constructor
Definition at line 26 of file termstructure.cpp.
|
explicit |
initialize with a fixed reference date
Definition at line 29 of file termstructure.cpp.
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.
|
overridedefault |
|
virtual |
the day counter used for date/time conversion
Reimplemented in CallableBondConstantVolatility, FactorSpreadedHazardRateCurve, SpreadedHazardRateCurve, ExtendedBlackVarianceCurve, ExtendedBlackVarianceSurface, SabrVolSurface, AndreasenHugeLocalVolAdapter, AndreasenHugeVolatilityAdapter, BlackVarianceCurve, BlackVarianceSurface, HestonBlackVolSurface, ImpliedVolTermStructure, LocalConstantVol, LocalVolCurve, LocalVolSurface, CapletVarianceCurve, SpreadedOptionletVolatility, SpreadedSwaptionVolatility, SwaptionVolatilityCube, CompositeZeroYieldStructure< BinaryFunction >, ForwardSpreadedTermStructure, ImpliedTermStructure, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, QuantoTermStructure, UltimateForwardTermStructure, and ZeroSpreadedTermStructure.
Definition at line 115 of file termstructure.hpp.
date/time conversion
Definition at line 133 of file termstructure.hpp.
|
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.
|
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.
|
virtual |
the date at which discount = 1.0 and/or variance = 0.0
Reimplemented in FactorSpreadedHazardRateCurve, SpreadedHazardRateCurve, SabrVolSurface, AndreasenHugeLocalVolAdapter, AndreasenHugeVolatilityAdapter, LocalVolCurve, LocalVolSurface, SpreadedOptionletVolatility, SpreadedSwaptionVolatility, SwaptionVolatilityCube, CompositeZeroYieldStructure< BinaryFunction >, ForwardSpreadedTermStructure, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, QuantoTermStructure, UltimateForwardTermStructure, and ZeroSpreadedTermStructure.
Definition at line 39 of file termstructure.cpp.
|
virtual |
the calendar used for reference and/or option date calculation
Reimplemented in FactorSpreadedHazardRateCurve, SpreadedHazardRateCurve, SabrVolSurface, AndreasenHugeLocalVolAdapter, AndreasenHugeVolatilityAdapter, LocalVolCurve, SpreadedOptionletVolatility, SpreadedSwaptionVolatility, SwaptionVolatilityCube, CompositeZeroYieldStructure< BinaryFunction >, ForwardSpreadedTermStructure, ImpliedTermStructure, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, QuantoTermStructure, UltimateForwardTermStructure, and ZeroSpreadedTermStructure.
Definition at line 123 of file termstructure.hpp.
|
virtual |
the settlementDays used for reference date calculation
Reimplemented in SabrVolSurface, AndreasenHugeLocalVolAdapter, AndreasenHugeVolatilityAdapter, SpreadedOptionletVolatility, SpreadedSwaptionVolatility, SwaptionVolatilityCube, CompositeZeroYieldStructure< BinaryFunction >, ForwardSpreadedTermStructure, ImpliedTermStructure, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, QuantoTermStructure, UltimateForwardTermStructure, and ZeroSpreadedTermStructure.
Definition at line 127 of file termstructure.hpp.
|
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.
date-range check
Definition at line 54 of file termstructure.cpp.
time-range check
Definition at line 64 of file termstructure.cpp.
|
protected |
Definition at line 104 of file termstructure.hpp.
|
mutableprotected |
Definition at line 105 of file termstructure.hpp.
|
protected |
Definition at line 106 of file termstructure.hpp.
|
mutableprivate |
Definition at line 108 of file termstructure.hpp.
|
private |
Definition at line 109 of file termstructure.hpp.
|
private |
Definition at line 110 of file termstructure.hpp.