Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
YoYInflationCurveObserverMoving< Interpolator > Class Template Reference

Inflation term structure based on the interpolation of zero rates. More...

#include <qle/termstructures/yoyinflationcurveobservermoving.hpp>

+ Inheritance diagram for YoYInflationCurveObserverMoving< Interpolator >:
+ Collaboration diagram for YoYInflationCurveObserverMoving< Interpolator >:

Public Member Functions

 YoYInflationCurveObserverMoving (Natural settlementDays, const Calendar &calendar, const DayCounter &dayCounter, const Period &lag, Frequency frequency, bool indexIsInterpolated, const std::vector< Time > &times, const std::vector< Handle< Quote > > &rates, const QuantLib::ext::shared_ptr< Seasonality > &seasonality=QuantLib::ext::shared_ptr< Seasonality >(), const Interpolator &interpolator=Interpolator())
 
InflationTermStructure interface
Date baseDate () const override
 
Time maxTime () const override
 
Date maxDate () const override
 
Inspectors
const std::vector< Time > & times () const
 
const std::vector< Real > & data () const
 
const std::vector< Rate > & rates () const
 
const std::vector< Handle< Quote > > & quotes () const
 
Observer interface
void update () override
 

Private Member Functions

LazyObject interface
void performCalculations () const override
 

YoYInflationTermStructure Interface

std::vector< Handle< Quote > > quotes_
 
bool indexIsInterpolated_
 
Date baseDate_
 
Rate yoyRateImpl (Time t) const override
 

Detailed Description

template<class Interpolator>
class QuantExt::YoYInflationCurveObserverMoving< Interpolator >

Inflation term structure based on the interpolation of zero rates.

Definition at line 40 of file yoyinflationcurveobservermoving.hpp.

Constructor & Destructor Documentation

◆ YoYInflationCurveObserverMoving()

YoYInflationCurveObserverMoving ( Natural  settlementDays,
const Calendar &  calendar,
const DayCounter &  dayCounter,
const Period &  lag,
Frequency  frequency,
bool  indexIsInterpolated,
const std::vector< Time > &  times,
const std::vector< Handle< Quote > > &  rates,
const QuantLib::ext::shared_ptr< Seasonality > &  seasonality = QuantLib::ext::shared_ptr<Seasonality>(),
const Interpolator &  interpolator = Interpolator() 
)

Definition at line 91 of file yoyinflationcurveobservermoving.hpp.

96 : YoYInflationTermStructure(settlementDays, calendar, dayCounter, rates[0]->value(), lag, frequency, indexIsInterpolated, seasonality),
97 InterpolatedCurve<Interpolator>(std::vector<Time>(), std::vector<Real>(), interpolator), quotes_(rates), indexIsInterpolated_(indexIsInterpolated) {
98
99 QL_REQUIRE(times.size() > 1, "too few times: " << times.size());
100 this->times_.resize(times.size());
101 this->times_[0] = times[0];
102 for (Size i = 1; i < times.size(); i++) {
103 QL_REQUIRE(times[i] > times[i - 1], "times not sorted");
104 this->times_[i] = times[i];
105 }
106
107 QL_REQUIRE(this->quotes_.size() == this->times_.size(),
108 "quotes/times count mismatch: " << this->quotes_.size() << " vs " << this->times_.size());
109
110 // initialise data vector, values are copied from quotes in performCalculations()
111 this->data_.resize(this->times_.size());
112 for (Size i = 0; i < this->times_.size(); i++)
113 this->data_[0] = 0.0;
114
115 this->interpolation_ =
116 this->interpolator_.interpolate(this->times_.begin(), this->times_.end(), this->data_.begin());
117 this->interpolation_.update();
118
119 // register with each of the quotes
120 for (Size i = 0; i < this->quotes_.size(); i++)
121 registerWith(this->quotes_[i]);
122}
+ Here is the call graph for this function:

Member Function Documentation

◆ baseDate()

Date baseDate
override

Definition at line 124 of file yoyinflationcurveobservermoving.hpp.

124 {
125 // if indexIsInterpolated we fixed the dates in the constructor
126 calculate();
127 return baseDate_;
128}

◆ maxTime()

Time maxTime
override

Definition at line 130 of file yoyinflationcurveobservermoving.hpp.

130{ return this->times_.back(); }

◆ maxDate()

Date maxDate
override

Definition at line 132 of file yoyinflationcurveobservermoving.hpp.

132{ return this->maxDate_; }

◆ times()

const std::vector< Time > & times

Definition at line 139 of file yoyinflationcurveobservermoving.hpp.

139 {
140 return this->times_;
141}
+ Here is the caller graph for this function:

◆ data()

const std::vector< Real > & data

Definition at line 148 of file yoyinflationcurveobservermoving.hpp.

148 {
149 calculate();
150 return this->data_;
151}

◆ rates()

const std::vector< Rate > & rates

Definition at line 143 of file yoyinflationcurveobservermoving.hpp.

143 {
144 calculate();
145 return this->data_;
146}

◆ quotes()

const std::vector< Handle< Quote > > & quotes ( ) const

Definition at line 64 of file yoyinflationcurveobservermoving.hpp.

64{ return quotes_; };

◆ update()

void update
override

Definition at line 153 of file yoyinflationcurveobservermoving.hpp.

153 {
154 LazyObject::update();
155 YoYInflationTermStructure::update();
156}

◆ performCalculations()

void performCalculations
overrideprivate

Definition at line 158 of file yoyinflationcurveobservermoving.hpp.

158 {
159 Date d = Settings::instance().evaluationDate();
160 Date d0 = d - this->observationLag();
162 baseDate_ = inflationPeriod(d0, this->frequency_).first;
163 } else {
164 baseDate_ = d0;
165 }
166
167 for (Size i = 0; i < this->times_.size(); ++i)
168 this->data_[i] = quotes_[i]->value();
169 this->interpolation_ =
170 this->interpolator_.interpolate(this->times_.begin(), this->times_.end(), this->data_.begin());
171 this->interpolation_.update();
172}

◆ yoyRateImpl()

Rate yoyRateImpl ( Time  t) const
overrideprotected

Definition at line 134 of file yoyinflationcurveobservermoving.hpp.

134 {
135 calculate();
136 return this->interpolation_(t, true);
137}

Member Data Documentation

◆ quotes_

std::vector<Handle<Quote> > quotes_
protected

Definition at line 83 of file yoyinflationcurveobservermoving.hpp.

◆ indexIsInterpolated_

bool indexIsInterpolated_
protected

Definition at line 84 of file yoyinflationcurveobservermoving.hpp.

◆ baseDate_

Date baseDate_
mutableprotected

Definition at line 85 of file yoyinflationcurveobservermoving.hpp.