Class DigitalOption

java.lang.Object
com.quantfinlib.pricing.DigitalOption

public final class DigitalOption extends Object
European digital (binary) options under Black-Scholes — the building blocks of the first-generation FX exotics book.

Parameter conventions match BlackScholes: rate is the domestic (quote-currency) rate, carry the continuous yield on the underlying (the foreign rate for FX under Garman-Kohlhagen, the dividend yield for equities), so the forward is S·e^{(r−q)t}.

  • Cash-or-nothing: pays a fixed amount if the option finishes in the money — payout·e^{−rt}·N(±d2). This is the market-standard "European digital".
  • Asset-or-nothing: pays the underlying itself — S·e^{−qt}·N(±d1). A vanilla decomposes exactly into asset-or-nothing minus strike × cash-or-nothing, which the tests assert.
  • Method Details

    • cashOrNothing

      public static double cashOrNothing(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears, double payout)
      Fixed payout if spot finishes beyond the strike (call: above, put: below).
    • cashOrNothingSkewAdjusted

      public static double cashOrNothingSkewAdjusted(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double volSlope, double timeYears, double payout)
      Cash-or-nothing digital consistent with a volatility smile: the limit of a tight call (put) spread priced on the smile,
        D_call = payout · [e^{−rT} N(d2) − vega(K) · ∂σ/∂K]
        D_put  = payout · [e^{−rT} N(−d2) + vega(K) · ∂σ/∂K]

      with σ = σ(K) and vega the Black-Scholes vega at that vol (Hull, Options, Futures, and Other Derivatives, the discussion of binary options and the volatility smile; Wystup 2006, section 1.5). With a negative skew (∂σ/∂K < 0) the call digital is worth more than its flat-vol price. The result is clamped to [0, payout·e^{−rT}].

      Parameters:
      volSlope - ∂σ/∂K at the strike, in vol per unit of strike
    • cashOrNothingSkewAdjusted

      public static double cashOrNothingSkewAdjusted(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, VolSurface surface, double timeYears, double payout)
      Skew-adjusted cash-or-nothing with vol and slope read from a VolSurface.
    • assetOrNothing

      public static double assetOrNothing(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears)
      Pays one unit of the underlying if the option finishes in the money.