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

Inflation term structure based on the interpolation of zero rates, with floating reference date. More...

#include <qle/termstructures/zeroinflationcurveobservermoving.hpp>

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

Public Member Functions

 ZeroInflationCurveObserverMoving (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
 

ZeroInflationTermStructure Interface

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

Detailed Description

template<class Interpolator>
class QuantExt::ZeroInflationCurveObserverMoving< Interpolator >

Inflation term structure based on the interpolation of zero rates, with floating reference date.

Definition at line 39 of file zeroinflationcurveobservermoving.hpp.

Constructor & Destructor Documentation

◆ ZeroInflationCurveObserverMoving()

ZeroInflationCurveObserverMoving ( 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 90 of file zeroinflationcurveobservermoving.hpp.

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

Member Function Documentation

◆ baseDate()

Date baseDate
override

Definition at line 123 of file zeroinflationcurveobservermoving.hpp.

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

◆ maxTime()

Time maxTime
override

Definition at line 129 of file zeroinflationcurveobservermoving.hpp.

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

◆ maxDate()

Date maxDate
override

Definition at line 131 of file zeroinflationcurveobservermoving.hpp.

131{ return this->maxDate_; }

◆ times()

const std::vector< Time > & times

Definition at line 138 of file zeroinflationcurveobservermoving.hpp.

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

◆ data()

const std::vector< Real > & data

Definition at line 147 of file zeroinflationcurveobservermoving.hpp.

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

◆ rates()

const std::vector< Rate > & rates

Definition at line 142 of file zeroinflationcurveobservermoving.hpp.

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

◆ quotes()

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

Definition at line 63 of file zeroinflationcurveobservermoving.hpp.

63{ return quotes_; };

◆ update()

void update
override

Definition at line 152 of file zeroinflationcurveobservermoving.hpp.

152 {
153 LazyObject::update();
154 ZeroInflationTermStructure::update();
155}

◆ performCalculations()

void performCalculations
overrideprivate

Definition at line 157 of file zeroinflationcurveobservermoving.hpp.

157 {
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}

◆ zeroRateImpl()

Rate zeroRateImpl ( Time  t) const
overrideprotected

Definition at line 133 of file zeroinflationcurveobservermoving.hpp.

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

Member Data Documentation

◆ quotes_

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

Definition at line 82 of file zeroinflationcurveobservermoving.hpp.

◆ indexIsInterpolated_

bool indexIsInterpolated_
protected

Definition at line 83 of file zeroinflationcurveobservermoving.hpp.

◆ baseDate_

Date baseDate_
mutableprotected

Definition at line 84 of file zeroinflationcurveobservermoving.hpp.