25#ifndef quantlib_interpolated_zeroinflationcurve_hpp
26#define quantlib_interpolated_zeroinflationcurve_hpp
38 template<
class Interpolator>
44 std::vector<Date>
dates,
45 const std::vector<Rate>&
rates,
48 const ext::shared_ptr<Seasonality>&
seasonality = {},
49 const Interpolator& interpolator = Interpolator());
61 std::vector<Date>
dates,
62 const std::vector<Rate>&
rates,
63 const Interpolator& interpolator = Interpolator());
73 const std::vector<Date>&
dates()
const;
74 const std::vector<Time>&
times()
const;
75 const std::vector<Real>&
data()
const;
76 const std::vector<Rate>&
rates()
const;
77 std::vector<std::pair<Date,Rate> >
nodes()
const;
95 const ext::shared_ptr<Seasonality>&
seasonality = {},
96 const Interpolator &interpolator = Interpolator());
109 const Interpolator &interpolator = Interpolator());
118 template <
class Interpolator>
120 const Date& referenceDate,
121 std::vector<Date> dates,
122 const std::vector<Rate>& rates,
125 const ext::shared_ptr<Seasonality>& seasonality,
126 const Interpolator& interpolator)
129 dates_(
std::move(dates)) {
134 "indices/dates count mismatch: " << this->data_.size() <<
" vs "
146 template <
class Interpolator>
152 const ext::shared_ptr<Seasonality>& seasonality,
153 const Interpolator& interpolator)
160 template <
class Interpolator>
162 const Date& referenceDate,
167 std::vector<Date> dates,
168 const std::vector<Rate>& rates,
169 const Interpolator& interpolator)
172 dates_(
std::move(dates)) {
179 std::pair<Date, Date> lim =
182 "first data date is not in base period, date: "
183 <<
dates_[0] <<
" not within [" << lim.first <<
"," << lim.second <<
"]");
186 "indices/dates count mismatch: " << this->data_.size() <<
" vs "
198 template <
class Interpolator>
206 const Interpolator& interpolator)
208 baseZeroRate, lag, frequency),
216 if (hasExplicitBaseDate())
219 return dates_.front();
224 if (hasExplicitBaseDate())
225 return dates_.back();
232 return this->interpolation_(
t,
true);
236 inline const std::vector<Time>&
242 inline const std::vector<Date>&
248 inline const std::vector<Rate>&
254 inline const std::vector<Real>&
260 inline std::vector<std::pair<Date,Rate> >
262 std::vector<std::pair<Date,Rate> >
results(dates_.size());
263 for (
Size i=0; i<dates_.size(); ++i)
264 results[i] = std::make_pair(dates_[i],this->data_[i]);
ext::shared_ptr< Seasonality > seasonality() const
virtual Period observationLag() const
virtual Date baseDate() const
minimum (base) date
virtual Frequency frequency() const
Helper class to build interpolated term structures.
Interpolation interpolation_
void setupTimes(const std::vector< Date > &dates, Date referenceDate, const DayCounter &dayCounter)
void setupInterpolation()
std::vector< Real > data_
Inflation term structure based on the interpolation of zero rates.
const std::vector< Rate > & rates() const
Rate zeroRateImpl(Time t) const override
to be defined in derived classes
std::vector< Date > dates_
const std::vector< Date > & dates() const
const std::vector< Real > & data() const
std::vector< std::pair< Date, Rate > > nodes() const
InterpolatedZeroInflationCurve(const Date &referenceDate, std::vector< Date > dates, const std::vector< Rate > &rates, Frequency frequency, const DayCounter &dayCounter, const ext::shared_ptr< Seasonality > &seasonality={}, const Interpolator &interpolator=Interpolator())
const std::vector< Time > & times() const
Date maxDate() const override
the latest date for which the curve can return values
Date baseDate() const override
minimum (base) date
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
virtual Calendar calendar() const
the calendar used for reference and/or option date calculation
virtual DayCounter dayCounter() const
the day counter used for date/time conversion
Interface for zero inflation term structures.
floating-point comparisons
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Frequency
Frequency of events.
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
Base classes for inflation term structures.
Helper class to build interpolated term structures.
linear interpolation between discrete points
InterpolatedZeroInflationCurve< Linear > ZeroInflationCurve
std::pair< Date, Date > inflationPeriod(const Date &d, Frequency frequency)
utility function giving the inflation period for a given date
#define QL_DEPRECATED_DISABLE_WARNING
#define QL_DEPRECATED_ENABLE_WARNING