24#ifndef quantlib_callable_bond_volatility_structure_hpp
25#define quantlib_callable_bond_volatility_structure_hpp
70 bool extrapolate =
false)
const;
75 bool extrapolate =
false)
const;
81 bool extrapolate =
false)
const;
86 bool extrapolate =
false)
const;
88 const Date& optionDate,
89 const Period& bondTenor)
const {
90 const std::pair<Time, Time> p =
convertDates(optionDate, bondTenor);
98 bool extrapolate =
false)
const;
103 bool extrapolate =
false)
const;
105 const Period& optionTenor,
106 const Period& bondTenor)
const;
121 const Date& optionDate,
122 const Period& bondTenor)
const;
132 Time bondLength)
const = 0;
137 Rate strike)
const = 0;
141 const std::pair<Time, Time> p =
convertDates(optionDate, bondTenor);
147 Rate strike,
bool extrapolate)
const;
161 const Period& optionTenor)
const {
171 bool extrapolate)
const {
172 checkRange(optionTime, bondLength, strike, extrapolate);
181 bool extrapolate)
const {
182 checkRange(optionTime, bondLength, strike, extrapolate);
184 return vol*vol*optionTime;
189 const Date& optionDate,
192 bool extrapolate)
const {
193 checkRange(optionDate, bondTenor, strike, extrapolate);
198 const Date& optionDate,
201 bool extrapolate)
const {
203 volatility(optionDate, bondTenor, strike, extrapolate);
204 const std::pair<Time, Time> p =
convertDates(optionDate, bondTenor);
205 return vol*vol*p.first;
209 const Period& optionTenor,
212 bool extrapolate)
const {
214 return volatility(optionDate, bondTenor, strike, extrapolate);
218 const Period& optionTenor,
221 bool extrapolate)
const {
224 volatility(optionDate, bondTenor, strike, extrapolate);
225 const std::pair<Time, Time> p =
convertDates(optionDate, bondTenor);
226 return vol*vol*p.first;
230 inline ext::shared_ptr<SmileSection>
232 const Period& optionTenor,
233 const Period& bondTenor)
const {
240 Time optionTime,
Time bondLength,
Rate k,
bool extrapolate)
const {
243 "negative bondLength (" << bondLength <<
") given");
246 "bondLength (" << bondLength <<
") is past max curve bondLength ("
250 "strike (" << k <<
") is outside the curve domain ["
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Callable-bond volatility structure.
Date optionDateFromTenor(const Period &optionTenor) const
implements the conversion between optionTenors and optionDates
virtual ext::shared_ptr< SmileSection > smileSection(const Date &optionDate, const Period &bondTenor) const
virtual const Period & maxBondTenor() const =0
the largest length for which the term structure can return vols
virtual Time maxBondLength() const
the largest bondLength for which the term structure can return vols
Real blackVariance(Time optionTime, Time bondLength, Rate strike, bool extrapolate=false) const
returns the Black variance for a given option time and bondLength
virtual Rate maxStrike() const =0
the maximum strike for which the term structure can return vols
virtual Volatility volatilityImpl(const Date &optionDate, const Period &bondTenor, Rate strike) const
virtual std::pair< Time, Time > convertDates(const Date &optionDate, const Period &bondTenor) const
implements the conversion between dates and times
BusinessDayConvention bdc_
virtual Rate minStrike() const =0
the minimum strike for which the term structure can return vols
virtual ext::shared_ptr< SmileSection > smileSectionImpl(Time optionTime, Time bondLength) const =0
return smile section
void checkRange(Time, Time, Rate strike, bool extrapolate) const
Volatility volatility(Time optionTime, Time bondLength, Rate strike, bool extrapolate=false) const
returns the volatility for a given option time and bondLength
virtual BusinessDayConvention businessDayConvention() const
the business day convention used for option date calculation
virtual Volatility volatilityImpl(Time optionTime, Time bondLength, Rate strike) const =0
implements the actual volatility calculation in derived classes
~CallableBondVolatilityStructure() override=default
Basic term-structure functionality.
virtual Natural settlementDays() const
the settlementDays used for reference date calculation
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
void checkRange(const Date &d, bool extrapolate) const
date-range check
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
BusinessDayConvention
Business Day conventions.
Real Time
continuous quantity with 1-year units
unsigned QL_INTEGER Natural
positive integer
Real Volatility
volatility
linear interpolation between discrete points
Smile section base class.
base class for term structures