Class ImpliedVolatility

java.lang.Object
com.quantfinlib.pricing.ImpliedVolatility

public final class ImpliedVolatility extends Object
Black (lognormal) implied volatility by a safeguarded Newton iteration on the normalised Black function.

Normalisation follows Jäckel (2015), "Let's be rational", Wilmott 2015(75): with x = ln(F/K) and s = σ√T the undiscounted price divided by √(FK) is

  b(x, s, θ) = θ·[e^{x/2} Φ(θ(x/s + s/2)) − e^{−x/2} Φ(θ(x/s − s/2))]

and ∂b/∂s = e^{x/2} φ(x/s + s/2). An in-the-money quote is first turned into the out-of-the-money one by put-call parity (removing the intrinsic value, which is where accuracy is lost if the ITM option is inverted directly), and the symmetry b(x, s, θ) = b(−x, s, −θ) reduces every case to an OTM call with x ≤ 0.

The solver is not Jäckel's rational-interpolation scheme. It uses the same objective transformation idea: below the inflection point s_c = √(2|x|), where b is convex in s, Newton runs on ln b (so prices of 1e-200 converge as fast as prices of 1e-2); above it, where b is concave, Newton runs on b itself. Every step is kept inside a bracket that shrinks with each evaluation, so the iteration cannot diverge; it usually converges to machine precision in under ten steps. Near the money the price is formed as sinh(x/2) plus odd parts of Φ to avoid the cancellation in Φ(d₁) − Φ(d₂) at very low total volatility.

Return conventions: NaN for a price outside the attainable range (below intrinsic, or at or above the zero-strike bound), 0 for a price exactly at intrinsic, NaN for non-finite or non-positive inputs.

  • Method Details

    • black

      public static double black(BlackScholes.OptionType type, double forwardPrice, double forward, double strike, double timeYears)
      Black implied volatility from an undiscounted (forward) option price.
      Parameters:
      forwardPrice - option price divided by the discount factor
      Returns:
      σ such that Black(F, K, σ, T) equals the price, or NaN
    • normalisedBlack

      public static double normalisedBlack(double x, double s, int theta)
      Normalised Black price b(x, s, θ) as defined in the class comment.