26#include <ql/cashflows/averagebmacoupon.hpp>
27#include <ql/indexes/iborindex.hpp>
28#include <ql/termstructures/volatility/smilesection.hpp>
36bool isOis(
const QuantLib::ext::shared_ptr<IborIndex>& index) {
37 return QuantLib::ext::dynamic_pointer_cast<QuantLib::OvernightIndex>(index) !=
nullptr;
40bool isBMA(
const QuantLib::ext::shared_ptr<IborIndex>& index) {
41 return QuantLib::ext::dynamic_pointer_cast<QuantExt::BMAIndexWrapper>(index) !=
nullptr;
47 const QuantLib::ext::shared_ptr<IborIndex>& baseIndex,
48 const QuantLib::ext::shared_ptr<IborIndex>& targetIndex,
49 const Period& baseRateComputationPeriod,
50 const Period& targetRateComputationPeriod)
51 : OptionletVolatilityStructure(baseVol->businessDayConvention(), baseVol->dayCounter()), baseVol_(baseVol),
52 baseIndex_(baseIndex), targetIndex_(targetIndex), baseRateComputationPeriod_(baseRateComputationPeriod),
53 targetRateComputationPeriod_(targetRateComputationPeriod) {
55 QL_REQUIRE(baseIndex !=
nullptr,
"ProxyOptionletVolatility: no base index given.");
56 QL_REQUIRE(targetIndex !=
nullptr,
"ProxyOptionletVolatility: no target index given.");
57 QL_REQUIRE((!isOis(
targetIndex_) && !isBMA(targetIndex)) || targetRateComputationPeriod != 0 * Days,
58 "ProxyOptionletVolatility: target index is OIS or BMA/SIFMA ("
59 << targetIndex->name() <<
"), so targetRateComputationPeriod must be given and != 0D.");
61 "ProxyOptionletVolatility: base index is OIS or BMA/SIFMA ("
62 << baseIndex->name() <<
"), so baseRateComputationPeriod must be given and != 0D.");
66 enableExtrapolation(baseVol->allowsExtrapolation());
103 QL_REQUIRE(!
baseVol_.empty(),
"ProxyOptionletVolatility: no base vol given.");
104 return QuantLib::ext::make_shared<AtmAdjustedSmileSection>(
baseVol_->smileSection(fixingDate,
true), baseAtmLevel,
109 return smileSection(optionTime)->volatility(strike);
wrapper class for bmaindex, for the purpose of providing iborindex inheritance.
QuantLib::ext::shared_ptr< QuantLib::IborIndex > baseIndex_
QuantLib::Handle< QuantLib::OptionletVolatilityStructure > baseVol_
QuantLib::Volatility volatilityImpl(QuantLib::Time optionTime, QuantLib::Rate strike) const override
QuantLib::ext::shared_ptr< QuantLib::IborIndex > targetIndex_
QuantLib::Period baseRateComputationPeriod_
QuantLib::ext::shared_ptr< QuantLib::SmileSection > smileSectionImpl(const QuantLib::Date &optionDate) const override
ProxyOptionletVolatility(const QuantLib::Handle< OptionletVolatilityStructure > &baseVol, const QuantLib::ext::shared_ptr< QuantLib::IborIndex > &baseIndex, const QuantLib::ext::shared_ptr< QuantLib::IborIndex > &targetIndex, const QuantLib::Period &baseRateComputationPeriod=0 *QuantLib::Days, const QuantLib::Period &targetRateComputationPeriod=0 *QuantLib::Days)
QuantLib::Period targetRateComputationPeriod_
const QuantLib::Date & referenceDate() const override
Real getOisAtmLevel(const QuantLib::ext::shared_ptr< OvernightIndex > &on, const Date &fixingDate, const Period &rateComputationPeriod)
QuantLib::Date lowerDate(const Real t, const QuantLib::Date &refDate, const QuantLib::DayCounter &dc)
Real getBMAAtmLevel(const QuantLib::ext::shared_ptr< BMAIndex > &bma, const Date &fixingDate, const Period &rateComputationPeriod)
coupon paying the compounded daily overnight rate, copy of QL class, added includeSpread flag
moneyness-adjusted optionlet vol for normal vols
some cashflow related utilities.