inline boost::shared_ptr<SmileSection> SwaptionVolatilityStructure::smileSection(Time optionTime, Time swapLength, bool extrapolate) const { checkSwapTenor(swapLength, extrapolate); checkRange(optionTime, extrapolate); return smileSectionImpl(optionTime, swapLength); }
inline boost::shared_ptr<SmileSection> SwaptionVolatilityStructure::smileSection(const Date& optionDate, const Period& swapTenor, bool extrapolate) const { checkSwapTenor(swapTenor, extrapolate); checkRange(optionDate, extrapolate); return smileSectionImpl(optionDate, swapTenor); }
boost::shared_ptr<SmileSection> Gaussian1dSwaptionVolatility::smileSectionImpl(Time optionTime, Time swapLength) const { DateHelper hlp(*this, optionTime); NewtonSafe newton; Date d(static_cast<BigInteger>(newton.solve( hlp, 0.1, 365.25 * optionTime + static_cast<Real>(referenceDate().serialNumber()), 1.0))); Period tenor( static_cast<Integer>(Rounding(0).operator()(swapLength * 12.0)), Months); d = indexBase_->fixingCalendar().adjust(d); return smileSectionImpl(d, tenor); }
boost::shared_ptr<SmileSection> SwaptionVolCube2::smileSectionImpl(Time optionTime, Time swapLength) const { calculate(); Date optionDate = optionDateFromTime(optionTime); Rounding rounder(0); Period swapTenor(static_cast<Integer>(rounder(swapLength*12.0)), Months); // ensure that option date is valid fixing date optionDate = swapTenor > shortSwapIndexBase_->tenor() ? swapIndexBase_->fixingCalendar().adjust(optionDate, Following) : shortSwapIndexBase_->fixingCalendar().adjust(optionDate, Following); return smileSectionImpl(optionDate, swapTenor); }
inline Volatility SwaptionVolatilityCube::volatilityImpl( Time optionTime, Time swapLength, Rate strike) const { return smileSectionImpl(optionTime, swapLength)->volatility(strike); }
inline Volatility SwaptionVolatilityCube::volatilityImpl( const Date& optionDate, const Period& swapTenor, Rate strike) const { return smileSectionImpl(optionDate, swapTenor)->volatility(strike); }
// 4. default implementation of Date-based xxxImpl methods // relying on the equivalent Time-based methods inline boost::shared_ptr<SmileSection> SwaptionVolatilityStructure::smileSectionImpl(const Date& optionDate, const Period& swapT) const { return smileSectionImpl(timeFromReference(optionDate), swapLength(swapT)); }
Volatility SingleSabrSwaptionVolatility::volatilityImpl(const Date& d, const Period& tenor, Rate strike) const { return smileSectionImpl(d,tenor)->volatility(strike); }
Volatility SingleSabrSwaptionVolatility::volatilityImpl(Time optionTime, Time swapLength, Rate strike) const { return smileSectionImpl(optionTime,swapLength)->volatility(strike); }
// 4. default implementation of Date-based xxxImpl methods // relying on the equivalent Time-based methods inline boost::shared_ptr<SmileSection> OptionletVolatilityStructure::smileSectionImpl(const Date& optionDate) const { return smileSectionImpl(timeFromReference(optionDate)); }
inline boost::shared_ptr<SmileSection> OptionletVolatilityStructure::smileSection(Time optionTime, bool extrapolate) const { checkRange(optionTime, extrapolate); return smileSectionImpl(optionTime); }
Volatility BlackVolSurface::atmVolImpl(Time t) const { const boost::shared_ptr<SmileSection>& s = smileSectionImpl(t); return s->volatility(s->atmLevel()); }
Real BlackVolSurface::atmVarianceImpl(Time t) const { const boost::shared_ptr<SmileSection>& s = smileSectionImpl(t); return s->variance(s->atmLevel()); }