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 | Protected Attributes | List of all members
Vasicek Class Reference

Vasicek model class More...

#include <vasicek.hpp>

+ Inheritance diagram for Vasicek:
+ Collaboration diagram for Vasicek:

Classes

class  Dynamics
 Short-rate dynamics in the Vasicek model. More...
 

Public Member Functions

 Vasicek (Rate r0=0.05, Real a=0.1, Real b=0.05, Real sigma=0.01, Real lambda=0.0)
 
Real discountBondOption (Option::Type type, Real strike, Time maturity, Time bondMaturity) const override
 
ext::shared_ptr< ShortRateDynamicsdynamics () const override
 returns the short-rate dynamics More...
 
Real a () const
 
Real b () const
 
Real lambda () const
 
Real sigma () const
 
Real r0 () const
 
- 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
 

Protected Member Functions

Real A (Time t, Time T) const override
 
Real B (Time t, Time T) const override
 
virtual Real A (Time t, Time T) const =0
 
virtual Real B (Time t, Time T) const =0
 
- Protected Member Functions inherited from CalibratedModel
virtual void generateArguments ()
 

Protected Attributes

Real r0_
 
Parametera_
 
Parameterb_
 
Parametersigma_
 
Parameterlambda_
 
- Protected Attributes inherited from CalibratedModel
std::vector< Parameterarguments_
 
ext::shared_ptr< Constraintconstraint_
 
EndCriteria::Type shortRateEndCriteria_ = EndCriteria::None
 
Array problemValues_
 
Integer functionEvaluation_
 

Additional Inherited Members

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

Detailed Description

Vasicek model class

This class implements the Vasicek model defined by

\[ dr_t = a(b - r_t)dt + \sigma dW_t , \]

where \( a \), \( b \) and \( \sigma \) are constants; a risk premium \( \lambda \) can also be specified.

Definition at line 42 of file vasicek.hpp.

Constructor & Destructor Documentation

◆ Vasicek()

Vasicek ( Rate  r0 = 0.05,
Real  a = 0.1,
Real  b = 0.05,
Real  sigma = 0.01,
Real  lambda = 0.0 
)

Definition at line 26 of file vasicek.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ discountBondOption()

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

Implements AffineModel.

Definition at line 57 of file vasicek.cpp.

+ Here is the call graph for this function:

◆ dynamics()

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

returns the short-rate dynamics

Implements OneFactorModel.

Definition at line 99 of file vasicek.hpp.

+ Here is the call graph for this function:

◆ a()

Real a ( ) const

Definition at line 54 of file vasicek.hpp.

+ Here is the caller graph for this function:

◆ b()

Real b ( ) const

Definition at line 55 of file vasicek.hpp.

+ Here is the caller graph for this function:

◆ lambda()

Real lambda ( ) const

Definition at line 56 of file vasicek.hpp.

+ Here is the caller graph for this function:

◆ sigma()

Real sigma ( ) const

Definition at line 57 of file vasicek.hpp.

+ Here is the caller graph for this function:

◆ r0()

Real r0 ( ) const

Definition at line 58 of file vasicek.hpp.

◆ A()

Real A ( Time  t,
Time  T 
) const
overrideprotectedvirtual

Implements OneFactorAffineModel.

Definition at line 36 of file vasicek.cpp.

+ Here is the call graph for this function:

◆ B()

Real B ( Time  t,
Time  T 
) const
overrideprotectedvirtual

Implements OneFactorAffineModel.

Definition at line 49 of file vasicek.cpp.

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

Member Data Documentation

◆ r0_

Real r0_
protected

Definition at line 64 of file vasicek.hpp.

◆ a_

Parameter& a_
protected

Definition at line 65 of file vasicek.hpp.

◆ b_

Parameter& b_
protected

Definition at line 66 of file vasicek.hpp.

◆ sigma_

Parameter& sigma_
protected

Definition at line 67 of file vasicek.hpp.

◆ lambda_

Parameter& lambda_
protected

Definition at line 68 of file vasicek.hpp.