Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ModelImpliedYieldTermStructure Class Reference

IR Implied Yield Term Structure. More...

#include <qle/models/modelimpliedyieldtermstructure.hpp>

+ Inheritance diagram for ModelImpliedYieldTermStructure:
+ Collaboration diagram for ModelImpliedYieldTermStructure:

Public Member Functions

 ModelImpliedYieldTermStructure (const QuantLib::ext::shared_ptr< IrModel > &model, const DayCounter &dc=DayCounter(), const bool purelyTimeBased=false)
 
Date maxDate () const override
 
Time maxTime () const override
 
const Date & referenceDate () const override
 
virtual void referenceDate (const Date &d)
 
virtual void referenceTime (const Time t)
 
void state (const Array &s)
 
void move (const Date &d, const Array &s)
 
void move (const Time t, const Array &s)
 
virtual void update () override
 

Protected Member Functions

Real discountImpl (Time t) const override
 

Protected Attributes

const QuantLib::ext::shared_ptr< IrModelmodel_
 
const bool purelyTimeBased_
 
Date referenceDate_
 
Real relativeTime_
 
Array state_
 

Detailed Description

IR Implied Yield Term Structure.

The termstructure has the reference date of the model's termstructure at construction, but you can vary this as well as the state. The purely time based variant is mainly there for perfomance reasons, note that it does not provide the full term structure interface and does not send notifications on reference time updates.

\ingroup models

Definition at line 46 of file modelimpliedyieldtermstructure.hpp.

Constructor & Destructor Documentation

◆ ModelImpliedYieldTermStructure()

ModelImpliedYieldTermStructure ( const QuantLib::ext::shared_ptr< IrModel > &  model,
const DayCounter &  dc = DayCounter(),
const bool  purelyTimeBased = false 
)

Definition at line 23 of file modelimpliedyieldtermstructure.cpp.

25 : YieldTermStructure(dc == DayCounter() ? model->termStructure()->dayCounter() : dc), model_(model),
26 purelyTimeBased_(purelyTimeBased),
27 referenceDate_(purelyTimeBased ? Null<Date>() : model_->termStructure()->referenceDate()),
28 state_(Array(model->n(), 0.0)) {
29 registerWith(model_);
30 update();
31}
const QuantLib::ext::shared_ptr< IrModel > model_
+ Here is the call graph for this function:

Member Function Documentation

◆ maxDate()

Date maxDate ( ) const
override

Definition at line 116 of file modelimpliedyieldtermstructure.hpp.

116 {
117 // we don't care - let the underlying classes throw
118 // exceptions if applicable
119 return Date::maxDate();
120}

◆ maxTime()

Time maxTime ( ) const
override

Definition at line 122 of file modelimpliedyieldtermstructure.hpp.

122 {
123 // see maxDate
124 return QL_MAX_REAL;
125}

◆ referenceDate() [1/2]

const Date & referenceDate ( ) const
override

Definition at line 127 of file modelimpliedyieldtermstructure.hpp.

127 {
128 QL_REQUIRE(!purelyTimeBased_, "reference date not available for purely "
129 "time based term structure");
130 return referenceDate_;
131}
+ Here is the caller graph for this function:

◆ referenceDate() [2/2]

void referenceDate ( const Date &  d)
virtual

Reimplemented in ModelImpliedYtsFwdFwdCorrected.

Definition at line 133 of file modelimpliedyieldtermstructure.hpp.

133 {
134 QL_REQUIRE(!purelyTimeBased_, "reference date not available for purely "
135 "time based term structure");
136 referenceDate_ = d;
137 update();
138}
+ Here is the call graph for this function:

◆ referenceTime()

void referenceTime ( const Time  t)
virtual

Reimplemented in ModelImpliedYtsFwdFwdCorrected.

Definition at line 147 of file modelimpliedyieldtermstructure.hpp.

147 {
148 QL_REQUIRE(purelyTimeBased_, "reference time can only be set for purely "
149 "time based term structure");
150 relativeTime_ = t;
151 notifyObservers();
152}
+ Here is the caller graph for this function:

◆ state()

void state ( const Array &  s)

Definition at line 161 of file modelimpliedyieldtermstructure.hpp.

161 {
162 state_ = s;
163 notifyObservers();
164}

◆ move() [1/2]

void move ( const Date &  d,
const Array &  s 
)

Definition at line 166 of file modelimpliedyieldtermstructure.hpp.

166 {
167 state_ = s;
168 referenceDate(d);
169}
+ Here is the call graph for this function:

◆ move() [2/2]

void move ( const Time  t,
const Array &  s 
)

Definition at line 171 of file modelimpliedyieldtermstructure.hpp.

171 {
172 state_ = s;
173 referenceTime(t);
174 notifyObservers();
175}
+ Here is the call graph for this function:

◆ update()

void update ( )
overridevirtual

Definition at line 177 of file modelimpliedyieldtermstructure.hpp.

177 {
178 if (!purelyTimeBased_) {
179 relativeTime_ = dayCounter().yearFraction(model_->termStructure()->referenceDate(), referenceDate_);
180 }
181 notifyObservers();
182}
+ Here is the caller graph for this function:

◆ discountImpl()

Real discountImpl ( Time  t) const
overrideprotected

Definition at line 184 of file modelimpliedyieldtermstructure.hpp.

184 {
185 QL_REQUIRE(t >= 0.0, "negative time (" << t << ") given");
186 return model_->discountBond(relativeTime_, relativeTime_ + t, state_);
187}
+ Here is the caller graph for this function:

Member Data Documentation

◆ model_

const QuantLib::ext::shared_ptr<IrModel> model_
protected

Definition at line 67 of file modelimpliedyieldtermstructure.hpp.

◆ purelyTimeBased_

const bool purelyTimeBased_
protected

Definition at line 68 of file modelimpliedyieldtermstructure.hpp.

◆ referenceDate_

Date referenceDate_
protected

Definition at line 69 of file modelimpliedyieldtermstructure.hpp.

◆ relativeTime_

Real relativeTime_
protected

Definition at line 70 of file modelimpliedyieldtermstructure.hpp.

◆ state_

Array state_
protected

Definition at line 71 of file modelimpliedyieldtermstructure.hpp.