Class BlackScholes

java.lang.Object
com.quantfinlib.pricing.BlackScholes

public final class BlackScholes extends Object
Black-Scholes-Merton option pricing and Greeks with a continuous carry yield q: set q to the dividend yield for equities or the foreign interest rate for FX (Garman-Kohlhagen). All rates and volatility are annualized; theta is per year; vega/rho are per 1.00 change.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    Full Greek set for one option.
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    delta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
     
    static double
    gamma(double spot, double strike, double rate, double carry, double vol, double timeYears)
     
    greeks(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
     
    static double
    impliedVol(BlackScholes.OptionType type, double marketPrice, double spot, double strike, double rate, double carry, double timeYears)
    Implied volatility by bisection.
    static double
    intrinsic(BlackScholes.OptionType type, double spot, double strike)
     
    static double
    price(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
     
    static double
    rho(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
    Per 1.00 change in the domestic rate.
    static double
    theta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
    Per year (divide by 365 for per-calendar-day).
    static double
    vega(double spot, double strike, double rate, double carry, double vol, double timeYears)
    Per 1.00 change in volatility (divide by 100 for per-vol-point).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • price

      public static double price(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
    • delta

      public static double delta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
    • gamma

      public static double gamma(double spot, double strike, double rate, double carry, double vol, double timeYears)
    • vega

      public static double vega(double spot, double strike, double rate, double carry, double vol, double timeYears)
      Per 1.00 change in volatility (divide by 100 for per-vol-point).
    • theta

      public static double theta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
      Per year (divide by 365 for per-calendar-day).
    • rho

      public static double rho(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
      Per 1.00 change in the domestic rate.
    • greeks

      public static BlackScholes.Greeks greeks(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
    • impliedVol

      public static double impliedVol(BlackScholes.OptionType type, double marketPrice, double spot, double strike, double rate, double carry, double timeYears)
      Implied volatility by bisection. Returns NaN when the price is not attainable inside the [1e-4, 5.0] vol bracket (below intrinsic, or above the maximum BS price) — a stale or rounded market price must surface as "no vol", not silently come back as the 500% search bound and poison a smile.
    • intrinsic

      public static double intrinsic(BlackScholes.OptionType type, double spot, double strike)