Exemplo n.º 1
0
 inline Volatility
 SwaptionVolatilityStructure::volatilityImpl(const Date& optionDate,
                                             const Period& swapTenor,
                                             Rate strike) const {
     return volatilityImpl(timeFromReference(optionDate),
                           swapLength(swapTenor),
                           strike);
 }
 inline
 Volatility CapFloorTermVolatilityStructure::volatility(Time t,
                                                        Rate strike,
                                                        bool extrap) const {
     checkRange(t, extrap);
     checkStrike(strike, extrap);
     return volatilityImpl(t, strike);
 }
 inline Volatility
 OptionletVolatilityStructure::volatility(Time optionTime,
                                          Rate strike,
                                          bool extrapolate) const {
     checkRange(optionTime, extrapolate);
     checkStrike(strike, extrapolate);
     return volatilityImpl(optionTime, strike);
 }
Exemplo n.º 4
0
 boost::shared_ptr<SmileSection>
 SwaptionVolatilityMatrix::smileSectionImpl(Time optionTime,
                                            Time swapLength) const {
     // dummy strike
     Volatility atmVol = volatilityImpl(optionTime, swapLength, 0.05);
     return boost::shared_ptr<SmileSection>(new
         FlatSmileSection(optionTime, atmVol, dayCounter()));
 }
    std::pair<std::vector<Rate>, std::vector<Volatility> >
    KInterpolatedYoYOptionletVolatilitySurface<Interpolator1D>::
    Dslice(const Date &d) const {
        // make sure that the correct D slice is in slice_
        Rate strike = (minStrike() + maxStrike())/2.0;
        Volatility v = volatilityImpl(d, strike); v = v+v;//dummy but needed

        return slice_;
    }
Exemplo n.º 6
0
 boost::shared_ptr<SmileSection>
 SwaptionVolatilityMatrix::smileSectionImpl(Time optionTime,
                                            Time swapLength) const {
     // dummy strike
     Volatility atmVol = volatilityImpl(optionTime, swapLength, 0.05);
     Real shift = interpolationShifts_(optionTime, swapLength,true);
     return boost::shared_ptr<SmileSection>(new FlatSmileSection(
         optionTime, atmVol, dayCounter(), Null<Real>(), shift));
 }
Exemplo n.º 7
0
 inline Volatility
 SwaptionVolatilityStructure::volatility(Time optionTime,
                                         Time swapLength,
                                         Rate strike,
                                         bool extrapolate) const {
     checkSwapTenor(swapLength, extrapolate);
     checkRange(optionTime, extrapolate);
     checkStrike(strike, extrapolate);
     return volatilityImpl(optionTime, swapLength, strike);
 }
Exemplo n.º 8
0
 // 3. relying on xxxImpl methods
 inline Volatility
 SwaptionVolatilityStructure::volatility(const Date& optionDate,
                                         const Period& swapTenor,
                                         Rate strike,
                                         bool extrapolate) const {
     checkSwapTenor(swapTenor, extrapolate);
     checkRange(optionDate, extrapolate);
     checkStrike(strike, extrapolate);
     return volatilityImpl(optionDate, swapTenor, strike);
 }
Exemplo n.º 9
0
 inline Volatility
 SwaptionVolatilityStructure::volatility(Time optionTime,
                                         const Period& swapTenor,
                                         Rate strike,
                                         bool extrapolate) const {
     checkSwapTenor(swapTenor, extrapolate);
     checkRange(optionTime, extrapolate);
     checkStrike(strike, extrapolate);
     Time length = swapLength(swapTenor);
     return volatilityImpl(optionTime, length, strike);
 }
    Volatility
    YoYOptionletVolatilitySurface::volatility(const Date& maturityDate,
                                              Rate strike,
                                              const Period &obsLag,
                                              bool extrapolate) const {

        Period useLag = obsLag;
        if (obsLag==Period(-1,Days)) {
            useLag = observationLag();
        }

        if (indexIsInterpolated()) {
            YoYOptionletVolatilitySurface::checkRange(maturityDate-useLag, strike, extrapolate);
            Time t = timeFromReference(maturityDate-useLag);
            return volatilityImpl(t,strike);
        } else {
            std::pair<Date,Date> dd = inflationPeriod(maturityDate-useLag, frequency());
            YoYOptionletVolatilitySurface::checkRange(dd.first, strike, extrapolate);
            Time t = timeFromReference(dd.first);
            return volatilityImpl(t,strike);
        }
    }
Exemplo n.º 11
0
 boost::shared_ptr<SmileSection>
 StrippedOptionletAdapter::smileSectionImpl(Time t) const {
     std::vector< Rate > optionletStrikes =
         optionletStripper_->optionletStrikes(
             0); // strikes are the same for all times ?!
     std::vector< Real > stddevs;
     for (Size i = 0; i < optionletStrikes.size(); i++) {
         stddevs.push_back(volatilityImpl(t, optionletStrikes[i]) *
                           std::sqrt(t));
     }
     // Extrapolation may be a problem with splines, but since minStrike()
     // and maxStrike() are set, we assume that no one will use stddevs for
     // strikes outside these strikes
     CubicInterpolation::BoundaryCondition bc =
         optionletStrikes.size() >= 4 ? CubicInterpolation::Lagrange
                                      : CubicInterpolation::SecondDerivative;
     return boost::make_shared< InterpolatedSmileSection< Cubic > >(
         t, optionletStrikes, stddevs, Null< Real >(),
         Cubic(CubicInterpolation::Spline, false, bc, 0.0, bc, 0.0),
         Actual365Fixed(), volatilityType(), displacement());
 }
Exemplo n.º 12
0
 inline Volatility SmileSection::volatility(Rate strike) const {
     return volatilityImpl(strike);
 }
Exemplo n.º 13
0
 inline Real SmileSection::varianceImpl(Rate strike) const {
     Volatility v = volatilityImpl(strike);
     return v*v*exerciseTime();
 }
Exemplo n.º 14
0
 inline Volatility
 OptionletVolatilityStructure::volatilityImpl(const Date& optionDate,
                                              Rate strike) const {
     return volatilityImpl(timeFromReference(optionDate), strike);
 }