SabrSmileSection::SabrSmileSection(Time timeToExpiry, Rate forward, const std::vector<Real>& sabrParams) : SmileSection(timeToExpiry), forward_(forward) { alpha_ = sabrParams[0]; beta_ = sabrParams[1]; nu_ = sabrParams[2]; rho_ = sabrParams[3]; QL_REQUIRE(forward_>0.0, "at the money forward rate must be " "positive: " << io::rate(forward_) << " not allowed"); validateSabrParameters(alpha_, beta_, nu_, rho_); }
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); }