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
ModelImpliedPriceTermStructure Class Reference

COM Implied Price Term Structure. More...

#include <qle/models/modelimpliedpricetermstructure.hpp>

+ Inheritance diagram for ModelImpliedPriceTermStructure:
+ Collaboration diagram for ModelImpliedPriceTermStructure:

Public Member Functions

 ModelImpliedPriceTermStructure (const QuantLib::ext::shared_ptr< CommodityModel > &model, const DayCounter &dc=DayCounter(), const bool purelyTimeBased=false)
 
Date maxDate () const override
 
Time maxTime () const override
 
const Date & referenceDate () const override
 
const QuantLib::Currency & currency () const override
 Price term structure interface. More...
 
std::vector< QuantLib::Date > pillarDates () const override
 The pillar dates for the PriceTermStructure. More...
 
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
 
- Public Member Functions inherited from PriceTermStructure
 PriceTermStructure (const QuantLib::DayCounter &dc=QuantLib::DayCounter())
 
 PriceTermStructure (const QuantLib::Date &referenceDate, const QuantLib::Calendar &cal=QuantLib::Calendar(), const QuantLib::DayCounter &dc=QuantLib::DayCounter())
 
 PriceTermStructure (QuantLib::Natural settlementDays, const QuantLib::Calendar &cal, const QuantLib::DayCounter &dc=QuantLib::DayCounter())
 
QuantLib::Real price (QuantLib::Time t, bool extrapolate=false) const
 
QuantLib::Real price (const QuantLib::Date &d, bool extrapolate=false) const
 
void update () override
 
virtual QuantLib::Time minTime () const
 The minimum time for which the curve can return values. More...
 

Protected Member Functions

Real priceImpl (Time t) const override
 
- Protected Member Functions inherited from PriceTermStructure
virtual QuantLib::Real priceImpl (QuantLib::Time) const =0
 Price calculation. More...
 
void checkRange (QuantLib::Time t, bool extrapolate) const
 Extra time range check for minimum time, then calls TermStructure::checkRange. More...
 

Protected Attributes

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

Detailed Description

COM Implied Price 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 modelimpliedpricetermstructure.hpp.

Constructor & Destructor Documentation

◆ ModelImpliedPriceTermStructure()

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

Definition at line 23 of file modelimpliedpricetermstructure.cpp.

25 : PriceTermStructure(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< CommodityModel > model_
PriceTermStructure(const QuantLib::DayCounter &dc=QuantLib::DayCounter())
+ Here is the call graph for this function:

Member Function Documentation

◆ maxDate()

Date maxDate ( ) const
override

Definition at line 80 of file modelimpliedpricetermstructure.hpp.

80 {
81 // we don't care - let the underlying classes throw
82 // exceptions if applicable
83 return Date::maxDate();
84}

◆ maxTime()

Time maxTime ( ) const
override

Definition at line 86 of file modelimpliedpricetermstructure.hpp.

86 {
87 // see maxDate
88 return QL_MAX_REAL;
89}

◆ referenceDate() [1/2]

const Date & referenceDate ( ) const
override

Definition at line 91 of file modelimpliedpricetermstructure.hpp.

91 {
92 QL_REQUIRE(!purelyTimeBased_, "reference date not available for purely "
93 "time based term structure");
94 return referenceDate_;
95}
+ Here is the caller graph for this function:

◆ currency()

const QuantLib::Currency & currency ( ) const
overridevirtual

Price term structure interface.

Implements PriceTermStructure.

Definition at line 57 of file modelimpliedpricetermstructure.hpp.

57{ return model_->currency(); }

◆ pillarDates()

std::vector< QuantLib::Date > pillarDates ( ) const
overridevirtual

The pillar dates for the PriceTermStructure.

Implements PriceTermStructure.

Definition at line 58 of file modelimpliedpricetermstructure.hpp.

58{ return std::vector<QuantLib::Date>(); }

◆ referenceDate() [2/2]

void referenceDate ( const Date &  d)
virtual

Definition at line 97 of file modelimpliedpricetermstructure.hpp.

97 {
98 QL_REQUIRE(!purelyTimeBased_, "reference date not available for purely "
99 "time based term structure");
100 referenceDate_ = d;
101 update();
102}
+ Here is the call graph for this function:

◆ referenceTime()

void referenceTime ( const Time  t)
virtual

Definition at line 105 of file modelimpliedpricetermstructure.hpp.

105 {
106 QL_REQUIRE(purelyTimeBased_, "reference time can only be set for purely "
107 "time based term structure");
108 relativeTime_ = t;
109 notifyObservers();
110}
+ Here is the caller graph for this function:

◆ state()

void state ( const Array &  s)

Definition at line 112 of file modelimpliedpricetermstructure.hpp.

112 {
113 state_ = s;
114 notifyObservers();
115}

◆ move() [1/2]

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

Definition at line 117 of file modelimpliedpricetermstructure.hpp.

117 {
118 state_ = s;
119 referenceDate(d);
120}
+ Here is the call graph for this function:

◆ move() [2/2]

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

Definition at line 122 of file modelimpliedpricetermstructure.hpp.

122 {
123 state_ = s;
124 referenceTime(t);
125 notifyObservers();
126}
+ Here is the call graph for this function:

◆ update()

void update ( )
overridevirtual

Definition at line 128 of file modelimpliedpricetermstructure.hpp.

128 {
129 if (!purelyTimeBased_) {
130 relativeTime_ = dayCounter().yearFraction(model_->termStructure()->referenceDate(), referenceDate_);
131 }
132 notifyObservers();
133}
+ Here is the caller graph for this function:

◆ priceImpl()

Real priceImpl ( Time  t) const
overrideprotected

Definition at line 135 of file modelimpliedpricetermstructure.hpp.

135 {
136 QL_REQUIRE(t >= 0.0, "negative time (" << t << ") given");
137 return model_->forwardPrice(relativeTime_, relativeTime_ + t, state_);
138}

Member Data Documentation

◆ model_

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

Definition at line 71 of file modelimpliedpricetermstructure.hpp.

◆ purelyTimeBased_

const bool purelyTimeBased_
protected

Definition at line 72 of file modelimpliedpricetermstructure.hpp.

◆ referenceDate_

Date referenceDate_
protected

Definition at line 73 of file modelimpliedpricetermstructure.hpp.

◆ relativeTime_

Real relativeTime_
protected

Definition at line 74 of file modelimpliedpricetermstructure.hpp.

◆ state_

Array state_
protected

Definition at line 75 of file modelimpliedpricetermstructure.hpp.