Class OptionsBook

java.lang.Object
com.quantfinlib.hedging.OptionsBook

public final class OptionsBook extends Object
An options book on one underlying: aggregate Greeks across positions, spot×vol scenario grids, and delta-gamma-vega-theta P&L explain — the risk view a desk runs, not a single option.

Positions carry their own implied vols (smile-aware if fed from VolSurface); quantities are signed (negative = short). The underlying hedge position is part of the book, so net delta reflects the hedged residual.

  • Constructor Details

    • OptionsBook

      public OptionsBook(double spot, double rate, double carry)
  • Method Details

    • addOption

      public OptionsBook addOption(OptionsBook.OptionPosition position)
    • addOption

      public OptionsBook addOption(String label, BlackScholes.OptionType type, double strike, double expiryYears, double quantity, double impliedVol)
    • addUnderlying

      public OptionsBook addUnderlying(double quantity)
      Adds (or hedges with) the underlying; negative = short.
    • spot

      public double spot()
    • positions

      public List<OptionsBook.OptionPosition> positions()
    • underlyingQuantity

      public double underlyingQuantity()
    • value

      public double value()
      Book value at current market (options MTM + underlying).
    • greeks

      public OptionsBook.BookGreeks greeks()
      Aggregated Greeks: options plus the underlying (delta 1 per unit).
    • valueAt

      public double valueAt(double newSpot, double volShift, double timeDecayYears)
      Full revaluation at a shifted market (parallel vol shift, time decay).
    • scenarioGrid

      public double[][] scenarioGrid(double[] spotShiftsPct, double[] volShiftsAbs)
      Spot×vol scenario P&L grid (full revaluation, no time decay): grid[i][j] = P&L at spot shifted by spotShiftsPct[i] (fraction, 0.05 = +5%) and vol shifted by volShiftsAbs[j] (absolute, 0.02 = +2 vol points).
    • pnlExplain

      public OptionsBook.PnlExplain pnlExplain(double newSpot, double volShift, double timeDecayYears)
      Second-order P&L explain versus full revaluation:
        dV ≈ Δ·dS + ½Γ·dS² + ν·dσ + vanna·dS·dσ + ½volga·dσ² + Θ·dt
      with Black-Scholes-Merton vanna −e^{−qT}·φ(d1)·d2/σ and volga ν·d1·d2/σ per position (Haug, The Complete Guide to Option Pricing Formulas, 2nd ed., 2.2). volShift is a parallel absolute shift of every position's implied vol (no smile dynamics); theta is per year, so timeDecayYears multiplies it directly. Rho and the time cross terms are left in unexplained.