Exemple #1
0
    Real unsafeShiftedSabrVolatility(Rate strike,
                              Rate forward,
                              Time expiryTime,
                              Real alpha,
                              Real beta,
                              Real nu,
                              Real rho,
                              Real shift) {

        return unsafeSabrVolatility(strike+shift,forward+shift,expiryTime,
                                    alpha,beta,nu,rho);

    }
Exemple #2
0
 Real sabrVolatility(Rate strike,
                     Rate forward,
                     Time expiryTime,
                     Real alpha,
                     Real beta,
                     Real nu,
                     Real rho) {
     QL_REQUIRE(strike>0.0, "strike must be positive: "
                            << io::rate(strike) << " not allowed");
     QL_REQUIRE(forward>0.0, "at the money forward rate must be "
                "positive: " << io::rate(forward) << " not allowed");
     QL_REQUIRE(expiryTime>=0.0, "expiry time must be non-negative: "
                                << expiryTime << " not allowed");
     validateSabrParameters(alpha, beta, nu, rho);
     return unsafeSabrVolatility(strike, forward, expiryTime,
                                 alpha, beta, nu, rho);
 }
Real NoArbSabrSmileSection::volatilityImpl(Rate strike) const {

    Real impliedVol = 0.0;
    try {
        Option::Type type;
        if (strike >= forward_)
            type = Option::Call;
        else
            type = Option::Put;
        impliedVol =
            blackFormulaImpliedStdDev(type, strike, forward_,
                                      optionPrice(strike, type, 1.0), 1.0) /
            std::sqrt(exerciseTime());
    } catch (...) {
    }
    if (impliedVol == 0.0)
        // fall back on Hagan 2002 expansion
        impliedVol =
            unsafeSabrVolatility(strike, forward_, exerciseTime(), params_[0],
                                 params_[1], params_[2], params_[3]);

    return impliedVol;
}
 Real SabrSmileSection::volatilityImpl(Rate strike) const {
    strike = std::max(0.00001,strike);
    return unsafeSabrVolatility(strike, forward_,
        exerciseTime(), alpha_, beta_, nu_, rho_);
 }