24#ifndef quantlib_yoy_optionlet_volatility_structures2_hpp
25#define quantlib_yoy_optionlet_volatility_structures2_hpp
27#include <ql/termstructures/voltermstructure.hpp>
28#include <ql/math/interpolation.hpp>
29#include <ql/time/calendars/target.hpp>
30#include <ql/termstructures/inflationtermstructure.hpp>
31#include <ql/termstructures/interpolatedcurve.hpp>
32#include <ql/termstructures/volatility/inflation/yoyinflationoptionletvolatilitystructure.hpp>
38 template <
class Interpolator1D>
57 const std::vector<Date> &d,
58 const std::vector<Volatility> &v,
81 virtual const std::vector<Time>&
times()
const {
return this->
times_;}
82 virtual const std::vector<Date>&
dates()
const {
return dates_;}
83 virtual const std::vector<Real>&
data()
const {
return this->
data_;}
84 virtual std::vector<std::pair<Date, Real> >
nodes()
const {
return nodes_;}
107 std::vector<std::pair<Date, Real> >
nodes_;
118 template<
class Interpolator1D>
126 bool indexIsInterpolated,
127 const std::vector<Date> &d,
128 const std::vector<Volatility> &v,
133 frequency, indexIsInterpolated),
135 dates_(d), minStrike_(minStrike), maxStrike_(maxStrike) {
136 QL_REQUIRE(d.size() == v.size(),
137 "must have same number of dates and vols: "
138 << d.size() <<
" vs " << v.size());
139 QL_REQUIRE(d.size() > 1,
140 "must have at least two dates: " << d.size());
142 for (
Size j = 0; j < d.size(); j++ ){
144 this->
data_.push_back(v[j]),
156 template<
class Interpolator1D>
164 bool indexIsInterpolated,
170 frequency, indexIsInterpolated),
172 minStrike_(minStrike), maxStrike_(maxStrike) {
181 template<
class Interpolator1D>
185 return this->interpolation_(t);
Helper class to build interpolated term structures.
std::vector< Time > times_
Interpolation interpolation_
void setupInterpolation()
std::vector< Real > data_
Interpolated flat smile surface.
std::vector< Date > dates_
virtual const std::vector< Real > & data() const
InterpolatedYoYOptionletVolatilityCurve(Natural settlementDays, const Calendar &, BusinessDayConvention bdc, const DayCounter &dc, const Period &lag, Frequency frequency, bool indexIsInterpolated, const std::vector< Date > &d, const std::vector< Volatility > &v, Rate minStrike, Rate maxStrike, const Interpolator1D &i=Interpolator1D())
calculate the reference date based on the global evaluation date
Real minStrike() const override
the minimum strike for which the term structure can return vols
InterpolatedYoYOptionletVolatilityCurve(Natural settlementDays, const Calendar &, BusinessDayConvention bdc, const DayCounter &dc, const Period &lag, Frequency frequency, bool indexIsInterpolated, Rate minStrike, Rate maxStrike, Volatility baseYoYVolatility, const Interpolator1D &i=Interpolator1D())
virtual const std::vector< Time > & times() const
Volatility volatilityImpl(Time length, Rate strike) const override
implements the actual volatility calculation in derived classes
~InterpolatedYoYOptionletVolatilityCurve() override=default
Date maxDate() const override
the latest date for which the curve can return values
virtual const std::vector< Date > & dates() const
Real maxStrike() const override
the maximum strike for which the term structure can return vols
std::vector< std::pair< Date, Real > > nodes_
virtual std::vector< std::pair< Date, Real > > nodes() const
virtual Natural settlementDays() const
the settlementDays used for reference date calculation
Time timeFromReference(const Date &date) const
date/time conversion
Date optionDateFromTenor(const Period &) const
period/date conversion
virtual bool indexIsInterpolated() const
virtual Date baseDate() const
virtual Frequency frequency() const
virtual void setBaseLevel(Volatility v)
Frequency
Frequency of events.
BusinessDayConvention
Business Day conventions.
Real Time
continuous quantity with 1-year units
unsigned QL_INTEGER Natural
positive integer
Real Volatility
volatility
std::size_t Size
size of a container