36 const Period& observationLag,
38 bool indexIsInterpolated,
43 frequency_(frequency), indexIsInterpolated_(indexIsInterpolated),
44 volType_(volType), displacement_(displacement) {
46 "YoYOptionletVolatilitySurface: displacement (" <<
displacement
47 <<
") must be 0 or 1");
68 bool extrapolate)
const {
70 "date (" <<
d <<
") is before base date");
72 "date (" <<
d <<
") is past max curve date ("
76 "strike (" << strike <<
") is outside the curve domain ["
82 bool extrapolate)
const {
84 "time (" <<
t <<
") is before base date");
86 "time (" <<
t <<
") is past max curve time ("
90 "strike (" << strike <<
") is outside the curve domain ["
99 bool extrapolate)
const {
123 bool extrapolate)
const {
125 return volatility(maturityDate, strike, obsLag, extrapolate);
135 const Period& obsLag)
const {
144 useDate = maturityDate - useLag;
161 bool extrapolate)
const {
190 const Period &observationLag,
192 bool indexIsInterpolated,
198 observationLag, frequency, indexIsInterpolated,
199 volType, displacement),
200 volatility_(ext::make_shared<
SimpleQuote>(
v)), minStrike_(minStrike), maxStrike_(maxStrike) {}
207 const Period& observationLag,
209 bool indexIsInterpolated,
223 volatility_(
std::move(
v)), minStrike_(minStrike), maxStrike_(maxStrike) {}
Handle< Quote > volatility_
ConstantYoYOptionletVolatility(Volatility v, Natural settlementDays, const Calendar &, BusinessDayConvention bdc, const DayCounter &dc, const Period &observationLag, Frequency frequency, bool indexIsInterpolated, Rate minStrike=-1.0, Rate maxStrike=100.0, VolatilityType volType=ShiftedLognormal, Real displacement=0.0)
calculate the reference date based on the global evaluation date
Volatility volatilityImpl(Time length, Rate strike) const override
implements the actual volatility calculation in derived classes
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
Shared handle to an observable.
template class providing a null value for a given type.
market element returning a stored value
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
virtual Time maxTime() const
the latest time for which the curve can return values
virtual Date maxDate() const =0
the latest date for which the curve can return values
Time timeFromReference(const Date &date) const
date/time conversion
virtual DayCounter dayCounter() const
the day counter used for date/time conversion
Volatility term structure.
Date optionDateFromTenor(const Period &) const
period/date conversion
Real minStrike() const override=0
the minimum strike for which the term structure can return vols
virtual Volatility volatilityImpl(Time length, Rate strike) const =0
virtual Time timeFromBase(const Date &date, const Period &obsLag=Period(-1, Days)) const
base date will be in the past because of observation lag
virtual Period observationLag() const
YoYOptionletVolatilitySurface(Natural settlementDays, const Calendar &, BusinessDayConvention bdc, const DayCounter &dc, const Period &observationLag, Frequency frequency, bool indexIsInterpolated, VolatilityType volType=ShiftedLognormal, Real displacement=0.0)
virtual bool indexIsInterpolated() const
virtual Date baseDate() const
virtual Frequency frequency() const
virtual void checkRange(const Date &, Rate strike, bool extrapolate) const
virtual Volatility totalVariance(const Date &exerciseDate, Rate strike, const Period &obsLag=Period(-1, Days), bool extrapolate=false) const
Returns the total integrated variance for a given exercise date and strike rate.
virtual Real displacement() const
Returns the displacement for lognormal volatilities.
Real maxStrike() const override=0
the maximum strike for which the term structure can return vols
Volatility volatility(const Date &maturityDate, Rate strike, const Period &obsLag=Period(-1, Days), bool extrapolate=false) const
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
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
Base classes for inflation term structures.
std::pair< Date, Date > inflationPeriod(const Date &d, Frequency frequency)
utility function giving the inflation period for a given date
bool close_enough(const Quantity &m1, const Quantity &m2, Size n)
ext::shared_ptr< BlackVolTermStructure > v
yoy inflation volatility structures