QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Gaussian1dModel Class Referenceabstract

#include <ql/models/shortrate/onefactormodels/gaussian1dmodel.hpp>

+ Inheritance diagram for Gaussian1dModel:
+ Collaboration diagram for Gaussian1dModel:

Classes

struct  CachedSwapKey
 
struct  CachedSwapKeyHasher
 

Public Member Functions

ext::shared_ptr< StochasticProcess1DstateProcess () const
 
Real numeraire (Time t, Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >()) const
 
Real zerobond (Time T, Time t=0.0, Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >()) const
 
Real numeraire (const Date &referenceDate, Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >()) const
 
Real zerobond (const Date &maturity, const Date &referenceDate=Null< Date >(), Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >()) const
 
Real zerobondOption (const Option::Type &type, const Date &expiry, const Date &valueDate, const Date &maturity, Rate strike, const Date &referenceDate=Null< Date >(), Real y=0.0, const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >(), Real yStdDevs=7.0, Size yGridPoints=64, bool extrapolatePayoff=true, bool flatPayoffExtrapolation=false) const
 
Real forwardRate (const Date &fixing, const Date &referenceDate=Null< Date >(), Real y=0.0, const ext::shared_ptr< IborIndex > &iborIdx=ext::shared_ptr< IborIndex >()) const
 
Real swapRate (const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), Real y=0.0, const ext::shared_ptr< SwapIndex > &swapIdx=ext::shared_ptr< SwapIndex >()) const
 
Real swapAnnuity (const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), Real y=0.0, const ext::shared_ptr< SwapIndex > &swapIdx=ext::shared_ptr< SwapIndex >()) const
 
Array yGrid (Real yStdDevs, int gridPoints, Real T=1.0, Real t=0, Real y=0) const
 
- Public Member Functions inherited from TermStructureConsistentModel
 TermStructureConsistentModel (Handle< YieldTermStructure > termStructure)
 
const Handle< YieldTermStructure > & termStructure () const
 
- 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 LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- 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 ()
 

Static Public Member Functions

static Real gaussianPolynomialIntegral (Real a, Real b, Real c, Real d, Real e, Real x0, Real x1)
 
static Real gaussianShiftedPolynomialIntegral (Real a, Real b, Real c, Real d, Real e, Real h, Real x0, Real x1)
 

Protected Member Functions

 Gaussian1dModel (const Handle< YieldTermStructure > &yieldTermStructure)
 
virtual Real numeraireImpl (Time t, Real y, const Handle< YieldTermStructure > &yts) const =0
 
virtual Real zerobondImpl (Time T, Time t, Real y, const Handle< YieldTermStructure > &yts) const =0
 
void performCalculations () const override
 
void generateArguments ()
 
ext::shared_ptr< VanillaSwapunderlyingSwap (const ext::shared_ptr< SwapIndex > &index, const Date &expiry, const Period &tenor) const
 
- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 

Protected Attributes

ext::shared_ptr< StochasticProcess1DstateProcess_
 
Date evaluationDate_
 
bool enforcesTodaysHistoricFixings_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Private Attributes

std::unordered_map< CachedSwapKey, ext::shared_ptr< VanillaSwap >, CachedSwapKeyHasherswapCache_
 

Additional Inherited Members

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

Detailed Description

One factor interest rate model interface class The only methods that must be implemented by subclasses are the numeraire and zerobond methods for an input array of state variable values. The variable $y$ is understood to be the standardized (zero mean, unit variance) version of the model's original state variable $x$.

NTL support may be enabled by defining GAUSS1D_ENABLE_NTL in this file. For details on NTL see http://www.shoup.net/ntl/

Warning:
the variance of the state process conditional on $x(t)=x$ must be independent of the value of $x$

Definition at line 72 of file gaussian1dmodel.hpp.

Constructor & Destructor Documentation

◆ Gaussian1dModel()

Gaussian1dModel ( const Handle< YieldTermStructure > &  yieldTermStructure)
protected

Definition at line 181 of file gaussian1dmodel.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ stateProcess()

ext::shared_ptr< StochasticProcess1D > stateProcess ( ) const

Definition at line 224 of file gaussian1dmodel.hpp.

◆ numeraire() [1/2]

Real numeraire ( Time  t,
Real  y = 0.0,
const Handle< YieldTermStructure > &  yts = Handle<YieldTermStructure>() 
) const

Definition at line 231 of file gaussian1dmodel.hpp.

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

◆ zerobond() [1/2]

Real zerobond ( Time  T,
Time  t = 0.0,
Real  y = 0.0,
const Handle< YieldTermStructure > &  yts = Handle<YieldTermStructure>() 
) const

Definition at line 238 of file gaussian1dmodel.hpp.

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

◆ numeraire() [2/2]

Real numeraire ( const Date referenceDate,
Real  y = 0.0,
const Handle< YieldTermStructure > &  yts = Handle<YieldTermStructure>() 
) const

Definition at line 244 of file gaussian1dmodel.hpp.

+ Here is the call graph for this function:

◆ zerobond() [2/2]

Real zerobond ( const Date maturity,
const Date referenceDate = Null<Date>(),
Real  y = 0.0,
const Handle< YieldTermStructure > &  yts = Handle<YieldTermStructure>() 
) const

Definition at line 251 of file gaussian1dmodel.hpp.

+ Here is the call graph for this function:

◆ zerobondOption()

Real zerobondOption ( const Option::Type type,
const Date expiry,
const Date valueDate,
const Date maturity,
Rate  strike,
const Date referenceDate = Null<Date>(),
Real  y = 0.0,
const Handle< YieldTermStructure > &  yts = Handle<YieldTermStructure>(),
Real  yStdDevs = 7.0,
Size  yGridPoints = 64,
bool  extrapolatePayoff = true,
bool  flatPayoffExtrapolation = false 
) const

Definition at line 143 of file gaussian1dmodel.cpp.

+ Here is the call graph for this function:

◆ forwardRate()

Real forwardRate ( const Date fixing,
const Date referenceDate = Null<Date>(),
Real  y = 0.0,
const ext::shared_ptr< IborIndex > &  iborIdx = ext::shared_ptr<IborIndex>() 
) const

Definition at line 27 of file gaussian1dmodel.cpp.

+ Here is the call graph for this function:

◆ swapRate()

Real swapRate ( const Date fixing,
const Period tenor,
const Date referenceDate = Null<Date>(),
Real  y = 0.0,
const ext::shared_ptr< SwapIndex > &  swapIdx = ext::shared_ptr<SwapIndex>() 
) const

Definition at line 53 of file gaussian1dmodel.cpp.

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

◆ swapAnnuity()

Real swapAnnuity ( const Date fixing,
const Period tenor,
const Date referenceDate = Null<Date>(),
Real  y = 0.0,
const ext::shared_ptr< SwapIndex > &  swapIdx = ext::shared_ptr<SwapIndex>() 
) const

Definition at line 113 of file gaussian1dmodel.cpp.

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

◆ gaussianPolynomialIntegral()

Real gaussianPolynomialIntegral ( Real  a,
Real  b,
Real  c,
Real  d,
Real  e,
Real  x0,
Real  x1 
)
static

Computes the integral

\[ {2\pi}^{-0.5} \int_{a}^{b} p(x) \exp{-0.5*x*x} \mathrm{d}x \]

with

\[ p(x) = ax^4+bx^3+cx^2+dx+e \]

.

Definition at line 207 of file gaussian1dmodel.cpp.

+ Here is the caller graph for this function:

◆ gaussianShiftedPolynomialIntegral()

Real gaussianShiftedPolynomialIntegral ( Real  a,
Real  b,
Real  c,
Real  d,
Real  e,
Real  h,
Real  x0,
Real  x1 
)
static

Computes the integral

\[ {2\pi}^{-0.5} \int_{a}^{b} p(x) \exp{-0.5*x*x} \mathrm{d}x \]

with

\[ p(x) = a(x-h)^4+b(x-h)^3+c(x-h)^2+d(x-h)+e \]

.

Definition at line 240 of file gaussian1dmodel.cpp.

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

◆ yGrid()

Array yGrid ( Real  yStdDevs,
int  gridPoints,
Real  T = 1.0,
Real  t = 0,
Real  y = 0 
) const

Generates a grid of values for the standardized state variable $y$ at time $T$ conditional on $y(t)=y$, covering yStdDevs standard deviations consisting of 2*gridPoints+1 points

Definition at line 249 of file gaussian1dmodel.cpp.

+ Here is the caller graph for this function:

◆ numeraireImpl()

virtual Real numeraireImpl ( Time  t,
Real  y,
const Handle< YieldTermStructure > &  yts 
) const
protectedpure virtual

Implemented in Gsr, and MarkovFunctional.

+ Here is the caller graph for this function:

◆ zerobondImpl()

virtual Real zerobondImpl ( Time  T,
Time  t,
Real  y,
const Handle< YieldTermStructure > &  yts 
) const
protectedpure virtual

Implemented in Gsr, and MarkovFunctional.

+ Here is the caller graph for this function:

◆ performCalculations()

void performCalculations ( ) const
overrideprotectedvirtual

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

Implements LazyObject.

Reimplemented in Gsr, and MarkovFunctional.

Definition at line 191 of file gaussian1dmodel.hpp.

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

◆ generateArguments()

void generateArguments ( )
protected

Definition at line 197 of file gaussian1dmodel.hpp.

+ Here is the call graph for this function:

◆ underlyingSwap()

ext::shared_ptr< VanillaSwap > underlyingSwap ( const ext::shared_ptr< SwapIndex > &  index,
const Date expiry,
const Period tenor 
) const
protected

Definition at line 205 of file gaussian1dmodel.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ swapCache_

std::unordered_map<CachedSwapKey, ext::shared_ptr<VanillaSwap>, CachedSwapKeyHasher> swapCache_
mutableprivate

Definition at line 177 of file gaussian1dmodel.hpp.

◆ stateProcess_

ext::shared_ptr<StochasticProcess1D> stateProcess_
protected

Definition at line 219 of file gaussian1dmodel.hpp.

◆ evaluationDate_

Date evaluationDate_
mutableprotected

Definition at line 220 of file gaussian1dmodel.hpp.

◆ enforcesTodaysHistoricFixings_

bool enforcesTodaysHistoricFixings_
mutableprotected

Definition at line 221 of file gaussian1dmodel.hpp.