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 | Private Attributes | List of all members
Gsr Class Reference

One factor gsr model, formulation is in forward measure. More...

#include <gsr.hpp>

+ Inheritance diagram for Gsr:
+ Collaboration diagram for Gsr:

Classes

struct  ReversionObserver
 
struct  VolatilityObserver
 

Public Member Functions

 Gsr (const Handle< YieldTermStructure > &termStructure, std::vector< Date > volstepdates, const std::vector< Real > &volatilities, Real reversion, Real T=60.0)
 
 Gsr (const Handle< YieldTermStructure > &termStructure, std::vector< Date > volstepdates, const std::vector< Real > &volatilities, const std::vector< Real > &reversions, Real T=60.0)
 
 Gsr (const Handle< YieldTermStructure > &termStructure, std::vector< Date > volstepdates, std::vector< Handle< Quote > > volatilities, const Handle< Quote > &reversion, Real T=60.0)
 
 Gsr (const Handle< YieldTermStructure > &termStructure, std::vector< Date > volstepdates, std::vector< Handle< Quote > > volatilities, std::vector< Handle< Quote > > reversions, Real T=60.0)
 
Real numeraireTime () const
 
void numeraireTime (Real T)
 
const Arrayreversion () const
 
const Arrayvolatility () const
 
std::vector< boolFixedReversions ()
 
std::vector< boolFixedVolatilities ()
 
std::vector< boolMoveVolatility (Size i)
 
std::vector< boolMoveReversion (Size i)
 
void calibrateVolatilitiesIterative (const std::vector< ext::shared_ptr< BlackCalibrationHelper > > &helpers, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >())
 
void calibrateReversionsIterative (const std::vector< ext::shared_ptr< BlackCalibrationHelper > > &helpers, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >())
 
- Public Member Functions inherited from Gaussian1dModel
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 ()
 
- 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
 

Protected Member Functions

Real numeraireImpl (Time t, Real y, const Handle< YieldTermStructure > &yts) const override
 
Real zerobondImpl (Time T, Time t, Real y, const Handle< YieldTermStructure > &yts) const override
 
void generateArguments () override
 
void update () override
 
void performCalculations () const override
 
- Protected Member Functions inherited from Gaussian1dModel
 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
 
virtual void generateArguments ()
 

Private Member Functions

void updateTimes () const
 
void updateVolatility ()
 
void updateReversion ()
 
void initialize (Real)
 

Private Attributes

Parameterreversion_
 
Parametersigma_
 
std::vector< Handle< Quote > > volatilities_
 
std::vector< Handle< Quote > > reversions_
 
std::vector< Datevolstepdates_
 
std::vector< Timevolsteptimes_
 
Array volsteptimesArray_
 
ext::shared_ptr< VolatilityObservervolatilityObserver_
 
ext::shared_ptr< ReversionObserverreversionObserver_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Static Public Member Functions inherited from Gaussian1dModel
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 Attributes inherited from Gaussian1dModel
ext::shared_ptr< StochasticProcess1DstateProcess_
 
Date evaluationDate_
 
bool enforcesTodaysHistoricFixings_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 
- Protected Attributes inherited from CalibratedModel
std::vector< Parameterarguments_
 
ext::shared_ptr< Constraintconstraint_
 
EndCriteria::Type shortRateEndCriteria_ = EndCriteria::None
 
Array problemValues_
 
Integer functionEvaluation_
 

Detailed Description

One factor gsr model, formulation is in forward measure.

Definition at line 34 of file gsr.hpp.

Constructor & Destructor Documentation

◆ Gsr() [1/4]

Gsr ( const Handle< YieldTermStructure > &  termStructure,
std::vector< Date volstepdates,
const std::vector< Real > &  volatilities,
Real  reversion,
Real  T = 60.0 
)

Definition at line 26 of file gsr.cpp.

+ Here is the call graph for this function:

◆ Gsr() [2/4]

Gsr ( const Handle< YieldTermStructure > &  termStructure,
std::vector< Date volstepdates,
const std::vector< Real > &  volatilities,
const std::vector< Real > &  reversions,
Real  T = 60.0 
)

Definition at line 45 of file gsr.cpp.

+ Here is the call graph for this function:

◆ Gsr() [3/4]

Gsr ( const Handle< YieldTermStructure > &  termStructure,
std::vector< Date volstepdates,
std::vector< Handle< Quote > >  volatilities,
const Handle< Quote > &  reversion,
Real  T = 60.0 
)

Definition at line 65 of file gsr.cpp.

+ Here is the call graph for this function:

◆ Gsr() [4/4]

Gsr ( const Handle< YieldTermStructure > &  termStructure,
std::vector< Date volstepdates,
std::vector< Handle< Quote > >  volatilities,
std::vector< Handle< Quote > >  reversions,
Real  T = 60.0 
)

Definition at line 79 of file gsr.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ numeraireTime() [1/2]

Real numeraireTime ( ) const

Definition at line 189 of file gsr.hpp.

◆ numeraireTime() [2/2]

void numeraireTime ( Real  T)

Definition at line 194 of file gsr.hpp.

◆ reversion()

const Array & reversion ( ) const

Definition at line 65 of file gsr.hpp.

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

◆ volatility()

const Array & volatility ( ) const

Definition at line 66 of file gsr.hpp.

+ Here is the call graph for this function:

◆ FixedReversions()

std::vector< bool > FixedReversions ( )

Definition at line 71 of file gsr.hpp.

◆ FixedVolatilities()

std::vector< bool > FixedVolatilities ( )

Definition at line 79 of file gsr.hpp.

◆ MoveVolatility()

std::vector< bool > MoveVolatility ( Size  i)

Definition at line 86 of file gsr.hpp.

+ Here is the caller graph for this function:

◆ MoveReversion()

std::vector< bool > MoveReversion ( Size  i)

Definition at line 95 of file gsr.hpp.

+ Here is the caller graph for this function:

◆ calibrateVolatilitiesIterative()

void calibrateVolatilitiesIterative ( const std::vector< ext::shared_ptr< BlackCalibrationHelper > > &  helpers,
OptimizationMethod method,
const EndCriteria endCriteria,
const Constraint constraint = Constraint(),
const std::vector< Real > &  weights = std::vector<Real>() 
)

Definition at line 110 of file gsr.hpp.

+ Here is the call graph for this function:

◆ calibrateReversionsIterative()

void calibrateReversionsIterative ( const std::vector< ext::shared_ptr< BlackCalibrationHelper > > &  helpers,
OptimizationMethod method,
const EndCriteria endCriteria,
const Constraint constraint = Constraint(),
const std::vector< Real > &  weights = std::vector<Real>() 
)

Definition at line 126 of file gsr.hpp.

+ Here is the call graph for this function:

◆ numeraireImpl()

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

Implements Gaussian1dModel.

Definition at line 204 of file gsr.cpp.

+ Here is the call graph for this function:

◆ zerobondImpl()

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

Implements Gaussian1dModel.

Definition at line 180 of file gsr.cpp.

+ Here is the call graph for this function:

◆ generateArguments()

void generateArguments ( )
overrideprotectedvirtual

Reimplemented from CalibratedModel.

Definition at line 144 of file gsr.hpp.

+ Here is the call graph for this function:

◆ update()

void update ( )
overrideprotectedvirtual

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.

Reimplemented from CalibratedModel.

Definition at line 92 of file gsr.cpp.

+ Here is the call graph for this function:
+ 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.

Reimplemented from Gaussian1dModel.

Definition at line 151 of file gsr.hpp.

+ Here is the call graph for this function:

◆ updateTimes()

void updateTimes ( ) const
private

Definition at line 98 of file gsr.cpp.

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

◆ updateVolatility()

void updateVolatility ( )
private

Definition at line 117 of file gsr.cpp.

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

◆ updateReversion()

void updateReversion ( )
private

Definition at line 124 of file gsr.cpp.

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

◆ initialize()

void initialize ( Real  T)
private

Definition at line 131 of file gsr.cpp.

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

Member Data Documentation

◆ reversion_

Parameter& reversion_
private

Definition at line 163 of file gsr.hpp.

◆ sigma_

Parameter & sigma_
private

Definition at line 163 of file gsr.hpp.

◆ volatilities_

std::vector<Handle<Quote> > volatilities_
private

Definition at line 165 of file gsr.hpp.

◆ reversions_

std::vector<Handle<Quote> > reversions_
private

Definition at line 166 of file gsr.hpp.

◆ volstepdates_

std::vector<Date> volstepdates_
private

Definition at line 167 of file gsr.hpp.

◆ volsteptimes_

std::vector<Time> volsteptimes_
mutableprivate

Definition at line 170 of file gsr.hpp.

◆ volsteptimesArray_

Array volsteptimesArray_
mutableprivate

Definition at line 171 of file gsr.hpp.

◆ volatilityObserver_

ext::shared_ptr<VolatilityObserver> volatilityObserver_
private

Definition at line 185 of file gsr.hpp.

◆ reversionObserver_

ext::shared_ptr<ReversionObserver> reversionObserver_
private

Definition at line 186 of file gsr.hpp.