Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

Real QuantLib::blackFormulaImpliedStdDev ( Option::Type  optionType,
Real  strike,
Real  forward,
Real  blackPrice,
Real  discount = 1.0,
Real  displacement = 0.0,
Real  guess = Null< Real >(),
Real  accuracy = 1.0e-6,
Natural  maxIterations = 100 
)

Black 1976 implied standard deviation, i.e. volatility*sqrt(timeToMaturity)

Definition at line 195 of file blackformula.cpp.

References blackFormulaImpliedStdDevApproximation(), QL_ENSURE, QL_REQUIRE, QuantLib::Solver1D< Impl >::setMaxEvaluations(), and QuantLib::Solver1D< Impl >::solve().

Referenced by blackFormulaImpliedStdDev(), QuantLib::OptionletStripper1::performCalculations(), QuantLib::ImpliedStdDevQuote::performCalculations(), and QuantLib::EurodollarFuturesImpliedStdDevQuote::performCalculations().

    {
        checkParameters(strike, forward, displacement);
        QL_REQUIRE(blackPrice>=0.0,
                   "blackPrice (" << blackPrice << ") must be non-negative");
        QL_REQUIRE(discount>0.0,
                   "discount (" << discount << ") must be positive");

        strike = strike + displacement;
        forward = forward + displacement;
        if (guess==Null<Real>())
            guess = blackFormulaImpliedStdDevApproximation(
                optionType, strike, forward, blackPrice, discount, displacement);
        else
            QL_REQUIRE(guess>=0.0,
                       "stdDev guess (" << guess << ") must be non-negative");
        BlackImpliedStdDevHelper f(optionType, strike, forward,
                                   blackPrice/discount);
        NewtonSafe solver;
        solver.setMaxEvaluations(maxIterations);
        Real minSdtDev = 0.0, maxStdDev = 3.0;
        Real stdDev = solver.solve(f, accuracy, guess, minSdtDev, maxStdDev);
        QL_ENSURE(stdDev>=0.0,
                  "stdDev (" << stdDev << ") must be non-negative");
        return stdDev;
    }


Generated by  Doxygen 1.6.0   Back to index