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 (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).
    • 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.