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

Two-additive-factor gaussian model class. More...

#include <ql/models/shortrate/twofactormodels/g2.hpp>

+ Inheritance diagram for G2:
+ Collaboration diagram for G2:

Classes

class  Dynamics
 
class  FittingParameter
 Analytical term-structure fitting parameter \( \varphi(t) \). More...
 

Public Member Functions

 G2 (const Handle< YieldTermStructure > &termStructure, Real a=0.1, Real sigma=0.01, Real b=0.1, Real eta=0.01, Real rho=-0.75)
 
ext::shared_ptr< ShortRateDynamicsdynamics () const override
 Returns the short-rate dynamics. More...
 
Real discountBond (Time now, Time maturity, Array factors) const override
 
Real discountBond (Time, Time, Rate, Rate) const
 
Real discountBondOption (Option::Type type, Real strike, Time maturity, Time bondMaturity) const override
 
Real swaption (const Swaption::arguments &arguments, Rate fixedRate, Real range, Size intervals) const
 
DiscountFactor discount (Time t) const override
 Implied discount curve. More...
 
Real a () const
 
Real sigma () const
 
Real b () const
 
Real eta () const
 
Real rho () const
 
- Public Member Functions inherited from TwoFactorModel
 TwoFactorModel (Size nParams)
 
virtual ext::shared_ptr< ShortRateDynamicsdynamics () const =0
 Returns the short-rate dynamics. More...
 
ext::shared_ptr< Latticetree (const TimeGrid &grid) const override
 Returns a two-dimensional trinomial tree. More...
 
- Public Member Functions inherited from ShortRateModel
 ShortRateModel (Size nArguments)
 
virtual ext::shared_ptr< Latticetree (const TimeGrid &) const =0
 
- Public Member Functions inherited from CalibratedModel
 CalibratedModel (Size nArguments)
 
void update () override
 
virtual void calibrate (const std::vector< ext::shared_ptr< CalibrationHelper > > &, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >(), const std::vector< bool > &fixParameters=std::vector< bool >())
 Calibrate to a set of market instruments (usually caps/swaptions) More...
 
Real value (const Array &params, const std::vector< ext::shared_ptr< CalibrationHelper > > &)
 
const ext::shared_ptr< Constraint > & constraint () const
 
EndCriteria::Type endCriteria () const
 Returns end criteria result. More...
 
const ArrayproblemValues () const
 Returns the problem values. More...
 
Array params () const
 Returns array of arguments on which calibration is done. More...
 
virtual void setParams (const Array &params)
 
Integer functionEvaluation () const
 
- 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 AffineModel
virtual DiscountFactor discount (Time t) const =0
 Implied discount curve. More...
 
virtual Real discountBond (Time now, Time maturity, Array factors) const =0
 
virtual Real discountBondOption (Option::Type type, Real strike, Time maturity, Time bondMaturity) const =0
 
virtual Real discountBondOption (Option::Type type, Real strike, Time maturity, Time bondStart, Time bondMaturity) const
 
- Public Member Functions inherited from TermStructureConsistentModel
 TermStructureConsistentModel (Handle< YieldTermStructure > termStructure)
 
const Handle< YieldTermStructure > & termStructure () const
 

Protected Member Functions

void generateArguments () override
 
Real A (Time t, Time T) const
 
Real B (Real x, Time t) const
 
virtual void generateArguments ()
 

Private Member Functions

Real sigmaP (Time t, Time s) const
 
Real V (Time t) const
 

Private Attributes

Parametera_
 
Parametersigma_
 
Parameterb_
 
Parametereta_
 
Parameterrho_
 
Parameter phi_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Attributes inherited from CalibratedModel
std::vector< Parameterarguments_
 
ext::shared_ptr< Constraintconstraint_
 
EndCriteria::Type shortRateEndCriteria_ = EndCriteria::None
 
Array problemValues_
 
Integer functionEvaluation_
 

Detailed Description

Two-additive-factor gaussian model class.

This class implements a two-additive-factor model defined by

\[ dr_t = \varphi(t) + x_t + y_t \]

where \( x_t \) and \( y_t \) are defined by

\[ dx_t = -a x_t dt + \sigma dW^1_t, x_0 = 0 \]

\[ dy_t = -b y_t dt + \sigma dW^2_t, y_0 = 0 \]

and \( dW^1_t dW^2_t = \rho dt \).

Bug:
This class was not tested enough to guarantee its functionality.

Definition at line 54 of file g2.hpp.

Constructor & Destructor Documentation

◆ G2()

G2 ( const Handle< YieldTermStructure > &  termStructure,
Real  a = 0.1,
Real  sigma = 0.01,
Real  b = 0.1,
Real  eta = 0.01,
Real  rho = -0.75 
)

Definition at line 31 of file g2.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ dynamics()

ext::shared_ptr< TwoFactorModel::ShortRateDynamics > dynamics ( ) const
overridevirtual

Returns the short-rate dynamics.

Implements TwoFactorModel.

Definition at line 48 of file g2.cpp.

+ Here is the call graph for this function:

◆ discountBond() [1/2]

Real discountBond ( Time  now,
Time  maturity,
Array  factors 
) const
overridevirtual

Implements AffineModel.

Definition at line 67 of file g2.hpp.

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

◆ discountBond() [2/2]

Real discountBond ( Time  t,
Time  T,
Rate  x,
Rate  y 
) const

Definition at line 75 of file g2.cpp.

+ Here is the call graph for this function:

◆ discountBondOption()

Real discountBondOption ( Option::Type  type,
Real  strike,
Time  maturity,
Time  bondMaturity 
) const
overridevirtual

Implements AffineModel.

Definition at line 79 of file g2.cpp.

+ Here is the call graph for this function:

◆ swaption()

Real swaption ( const Swaption::arguments arguments,
Rate  fixedRate,
Real  range,
Size  intervals 
) const

Definition at line 218 of file g2.cpp.

+ Here is the call graph for this function:

◆ discount()

DiscountFactor discount ( Time  t) const
overridevirtual

Implied discount curve.

Implements AffineModel.

Definition at line 85 of file g2.hpp.

+ Here is the call graph for this function:

◆ a()

Real a ( ) const

Definition at line 87 of file g2.hpp.

+ Here is the caller graph for this function:

◆ sigma()

Real sigma ( ) const

Definition at line 88 of file g2.hpp.

+ Here is the caller graph for this function:

◆ b()

Real b ( ) const

Definition at line 89 of file g2.hpp.

+ Here is the caller graph for this function:

◆ eta()

Real eta ( ) const

Definition at line 90 of file g2.hpp.

+ Here is the caller graph for this function:

◆ rho()

Real rho ( ) const

Definition at line 91 of file g2.hpp.

+ Here is the caller graph for this function:

◆ generateArguments()

void generateArguments ( )
overrideprotectedvirtual

Reimplemented from CalibratedModel.

Definition at line 53 of file g2.cpp.

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

◆ A()

Real A ( Time  t,
Time  T 
) const
protected

Definition at line 102 of file g2.cpp.

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

◆ B()

Real B ( Real  x,
Time  t 
) const
protected

Definition at line 107 of file g2.cpp.

+ Here is the caller graph for this function:

◆ sigmaP()

Real sigmaP ( Time  t,
Time  s 
) const
private

Definition at line 59 of file g2.cpp.

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

◆ V()

Real V ( Time  t) const
private

Definition at line 89 of file g2.cpp.

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

Member Data Documentation

◆ a_

Parameter& a_
private

Definition at line 105 of file g2.hpp.

◆ sigma_

Parameter& sigma_
private

Definition at line 106 of file g2.hpp.

◆ b_

Parameter& b_
private

Definition at line 107 of file g2.hpp.

◆ eta_

Parameter& eta_
private

Definition at line 108 of file g2.hpp.

◆ rho_

Parameter& rho_
private

Definition at line 109 of file g2.hpp.

◆ phi_

Parameter phi_
private

Definition at line 111 of file g2.hpp.