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

Generalized Hull-White model class. More...

#include <generalizedhullwhite.hpp>

+ Inheritance diagram for GeneralizedHullWhite:
+ Collaboration diagram for GeneralizedHullWhite:

Classes

class  Dynamics
 Short-rate dynamics in the generalized Hull-White model. More...
 
class  FittingParameter
 Analytical term-structure fitting parameter \( \varphi(t) \). More...
 

Public Member Functions

 GeneralizedHullWhite (const Handle< YieldTermStructure > &yieldtermStructure, const std::vector< Date > &speedstructure, const std::vector< Date > &volstructure, const std::vector< Real > &speed, const std::vector< Real > &vol, const ext::function< Real(Real)> &f={}, const ext::function< Real(Real)> &fInverse={})
 
template<class SpeedInterpolationTraits , class VolInterpolationTraits >
 GeneralizedHullWhite (const Handle< YieldTermStructure > &yieldtermStructure, const std::vector< Date > &speedstructure, const std::vector< Date > &volstructure, const std::vector< Real > &speed, const std::vector< Real > &vol, const SpeedInterpolationTraits &speedtraits, const VolInterpolationTraits &voltraits, const ext::function< Real(Real)> &f={}, const ext::function< Real(Real)> &fInverse={})
 
ext::shared_ptr< ShortRateDynamicsdynamics () const override
 returns the short-rate dynamics More...
 
ext::shared_ptr< Latticetree (const TimeGrid &grid) const override
 
 GeneralizedHullWhite (const Handle< YieldTermStructure > &yieldtermStructure, Real a=0.1, Real sigma=0.01)
 
ext::shared_ptr< ShortRateDynamicsHWdynamics () const
 
Real discountBondOption (Option::Type type, Real strike, Time maturity, Time bondMaturity) const override
 Only valid under Hull-White model. More...
 
std::vector< boolfixedReversion () const
 vector to pass to 'calibrate' to fit only volatility More...
 
- Public Member Functions inherited from OneFactorAffineModel
 OneFactorAffineModel (Size nArguments)
 
Real discountBond (Time now, Time maturity, Array factors) const override
 
Real discountBond (Time now, Time maturity, Rate rate) const
 
DiscountFactor discount (Time t) const override
 Implied discount curve. More...
 
- Public Member Functions inherited from OneFactorModel
 OneFactorModel (Size nArguments)
 
 ~OneFactorModel () override=default
 
virtual ext::shared_ptr< ShortRateDynamicsdynamics () const =0
 returns the short-rate dynamics More...
 
ext::shared_ptr< Latticetree (const TimeGrid &grid) const override
 Return by default a trinomial recombining 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

Real a () const
 
Real sigma () const
 
void generateArguments () override
 
Real A (Time t, Time T) const override
 
Real B (Time t, Time T) const override
 
Real V (Time t, Time T) const
 
virtual Real A (Time t, Time T) const =0
 
virtual Real B (Time t, Time T) const =0
 
virtual void generateArguments ()
 

Private Member Functions

ext::function< Real(Time)> speed () const
 
ext::function< Real(Time)> vol () const
 
template<class SpeedInterpolationTraits , class VolInterpolationTraits >
void initialize (const Handle< YieldTermStructure > &yieldtermStructure, const std::vector< Date > &speedstructure, const std::vector< Date > &volstructure, const std::vector< Real > &speed, const std::vector< Real > &vol, const SpeedInterpolationTraits &speedtraits, const VolInterpolationTraits &voltraits, const ext::function< Real(Real)> &f, const ext::function< Real(Real)> &fInverse)
 

Static Private Member Functions

static Real identity (Real x)
 

Private Attributes

std::vector< Datespeedstructure_
 
std::vector< Datevolstructure_
 
std::vector< Timespeedperiods_
 
std::vector< Timevolperiods_
 
Interpolation speed_
 
Interpolation vol_
 
Parametera_
 
Parametersigma_
 
Parameter phi_
 
ext::function< Real(Real)> f_
 
ext::function< Real(Real)> fInverse_
 

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

Generalized Hull-White model class.

This class implements the standard Black-Karasinski model defined by

\[ d f(r_t) = (\theta(t) - \alpha f(r_t))dt + \sigma dW_t, \]

where \( alpha \) and \( sigma \) are piecewise linear functions.

Definition at line 72 of file generalizedhullwhite.hpp.

Constructor & Destructor Documentation

◆ GeneralizedHullWhite() [1/3]

GeneralizedHullWhite ( const Handle< YieldTermStructure > &  yieldtermStructure,
const std::vector< Date > &  speedstructure,
const std::vector< Date > &  volstructure,
const std::vector< Real > &  speed,
const std::vector< Real > &  vol,
const ext::function< Real(Real)> &  f = {},
const ext::function< Real(Real)> &  fInverse = {} 
)

Definition at line 82 of file generalizedhullwhite.cpp.

+ Here is the call graph for this function:

◆ GeneralizedHullWhite() [2/3]

GeneralizedHullWhite ( const Handle< YieldTermStructure > &  yieldtermStructure,
const std::vector< Date > &  speedstructure,
const std::vector< Date > &  volstructure,
const std::vector< Real > &  speed,
const std::vector< Real > &  vol,
const SpeedInterpolationTraits &  speedtraits,
const VolInterpolationTraits &  voltraits,
const ext::function< Real(Real)> &  f = {},
const ext::function< Real(Real)> &  fInverse = {} 
)

Definition at line 86 of file generalizedhullwhite.hpp.

◆ GeneralizedHullWhite() [3/3]

GeneralizedHullWhite ( const Handle< YieldTermStructure > &  yieldtermStructure,
Real  a = 0.1,
Real  sigma = 0.01 
)

Definition at line 102 of file generalizedhullwhite.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ dynamics()

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

returns the short-rate dynamics

Implements OneFactorModel.

Definition at line 105 of file generalizedhullwhite.hpp.

◆ tree()

ext::shared_ptr< Lattice > tree ( const TimeGrid grid) const
overridevirtual

Implements ShortRateModel.

Definition at line 211 of file generalizedhullwhite.cpp.

+ Here is the call graph for this function:

◆ HWdynamics()

ext::shared_ptr< OneFactorModel::ShortRateDynamics > HWdynamics ( ) const

Definition at line 300 of file generalizedhullwhite.hpp.

+ Here is the call graph for this function:

◆ discountBondOption()

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

Only valid under Hull-White model.

Implements AffineModel.

Definition at line 181 of file generalizedhullwhite.cpp.

+ Here is the call graph for this function:

◆ fixedReversion()

std::vector< bool > fixedReversion ( ) const

vector to pass to 'calibrate' to fit only volatility

Definition at line 253 of file generalizedhullwhite.cpp.

+ Here is the call graph for this function:

◆ a()

Real a ( ) const
protected

Definition at line 132 of file generalizedhullwhite.hpp.

+ Here is the caller graph for this function:

◆ sigma()

Real sigma ( ) const
protected

Definition at line 133 of file generalizedhullwhite.hpp.

+ Here is the caller graph for this function:

◆ generateArguments()

void generateArguments ( )
overrideprotectedvirtual

Reimplemented from CalibratedModel.

Definition at line 122 of file generalizedhullwhite.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
overrideprotectedvirtual

Implements OneFactorAffineModel.

Definition at line 199 of file generalizedhullwhite.cpp.

+ Here is the call graph for this function:

◆ B()

Real B ( Time  t,
Time  T 
) const
overrideprotectedvirtual

Implements OneFactorAffineModel.

Definition at line 128 of file generalizedhullwhite.cpp.

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

◆ V()

Real V ( Time  t,
Time  T 
) const
protected

Definition at line 152 of file generalizedhullwhite.cpp.

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

◆ speed()

ext::function< Real(Time)> speed ( ) const
private

Definition at line 244 of file generalizedhullwhite.cpp.

+ Here is the caller graph for this function:

◆ vol()

ext::function< Real(Time)> vol ( ) const
private

Definition at line 248 of file generalizedhullwhite.cpp.

+ Here is the caller graph for this function:

◆ identity()

static Real identity ( Real  x)
staticprivate

Definition at line 162 of file generalizedhullwhite.hpp.

+ Here is the caller graph for this function:

◆ initialize()

void initialize ( const Handle< YieldTermStructure > &  yieldtermStructure,
const std::vector< Date > &  speedstructure,
const std::vector< Date > &  volstructure,
const std::vector< Real > &  speed,
const std::vector< Real > &  vol,
const SpeedInterpolationTraits &  speedtraits,
const VolInterpolationTraits &  voltraits,
const ext::function< Real(Real)> &  f,
const ext::function< Real(Real)> &  fInverse 
)
private

Definition at line 167 of file generalizedhullwhite.hpp.

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

Member Data Documentation

◆ speedstructure_

std::vector<Date> speedstructure_
private

Definition at line 145 of file generalizedhullwhite.hpp.

◆ volstructure_

std::vector<Date> volstructure_
private

Definition at line 146 of file generalizedhullwhite.hpp.

◆ speedperiods_

std::vector<Time> speedperiods_
private

Definition at line 147 of file generalizedhullwhite.hpp.

◆ volperiods_

std::vector<Time> volperiods_
private

Definition at line 148 of file generalizedhullwhite.hpp.

◆ speed_

Interpolation speed_
private

Definition at line 149 of file generalizedhullwhite.hpp.

◆ vol_

Interpolation vol_
private

Definition at line 150 of file generalizedhullwhite.hpp.

◆ a_

Parameter& a_
private

Definition at line 155 of file generalizedhullwhite.hpp.

◆ sigma_

Parameter& sigma_
private

Definition at line 156 of file generalizedhullwhite.hpp.

◆ phi_

Parameter phi_
private

Definition at line 157 of file generalizedhullwhite.hpp.

◆ f_

ext::function<Real(Real)> f_
private

Definition at line 159 of file generalizedhullwhite.hpp.

◆ fInverse_

ext::function<Real(Real)> fInverse_
private

Definition at line 160 of file generalizedhullwhite.hpp.