Class HigherOrderGreeks

java.lang.Object
com.quantfinlib.pricing.HigherOrderGreeks

public final class HigherOrderGreeks extends Object
The second-order Greeks a vol book actually hedges with — analytic Black-Scholes forms, the risk-side complement to BlackScholes.greeks(com.quantfinlib.pricing.BlackScholes.OptionType, double, double, double, double, double, double):
  • Vanna ∂²V/∂S∂σ — how delta drifts when vol moves (equivalently, how vega drifts when spot moves). THE skew-hedging Greek: a delta-hedged book with vanna is not hedged through a spot-vol move, which is how equity markets actually move (down-spot, up-vol);
  • Volga ∂²V/∂σ² (vomma) — vega convexity: a vega-hedged book with volga re-exposes itself as soon as vol moves. Vanna and volga are the two Greeks the VannaVolga pricing method charges the smile for;
  • Cross-gamma — for a TWO-asset position, the P&L term ∂²V/∂S₁∂S₂ that plain per-asset gammas miss; supplied here for the exchange-option/basket case under a correlation (the general multi-asset case needs the full Hessian of your specific payoff).

Same conventions as BlackScholes: carry is the continuous YIELD q (dividend yield; the foreign rate for FX), so the spot prefix is e^{−qT} and the drift is r − q — exactly the parameters you already pass to BlackScholes.delta/vega, and the tests pin these formulas as finite differences of those. Vol per √year, all static and allocation-free. Vanna/volga are identical for calls and puts (put-call parity kills the sign difference in the second order).

  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    exchangeCrossGamma(double spot1, double spot2, double vol1, double vol2, double correlation, double timeYears)
    Cross-gamma of a Margrabe exchange option (the right to exchange asset 2 for asset 1) — the canonical two-asset second-order term: ∂²V/∂S₁∂S₂ = −φ(d₁)/(S₂·σ̂·√T) where σ̂² = σ₁² + σ₂² − 2ρσ₁σ₂.
    static double
    vanna(double spot, double strike, double rate, double carry, double vol, double timeYears)
    Vanna ∂²V/∂S∂σ: per 1.00 spot × 1.00 vol.
    static double
    volga(double spot, double strike, double rate, double carry, double vol, double timeYears)
    Volga (vomma) ∂²V/∂σ²: vega convexity.

    Methods inherited from class java.lang.Object

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

    • vanna

      public static double vanna(double spot, double strike, double rate, double carry, double vol, double timeYears)
      Vanna ∂²V/∂S∂σ: per 1.00 spot × 1.00 vol. Same for calls and puts.
    • volga

      public static double volga(double spot, double strike, double rate, double carry, double vol, double timeYears)
      Volga (vomma) ∂²V/∂σ²: vega convexity. Same for calls and puts.
    • exchangeCrossGamma

      public static double exchangeCrossGamma(double spot1, double spot2, double vol1, double vol2, double correlation, double timeYears)
      Cross-gamma of a Margrabe exchange option (the right to exchange asset 2 for asset 1) — the canonical two-asset second-order term: ∂²V/∂S₁∂S₂ = −φ(d₁)/(S₂·σ̂·√T) where σ̂² = σ₁² + σ₂² − 2ρσ₁σ₂. Negative: the exchange option loses convexity when the two legs move together. For a generic basket, differentiate YOUR pricer numerically instead — this is the closed form worth having, not a universal answer.