Class OptionsBook
java.lang.Object
com.quantfinlib.hedging.OptionsBook
An options book on one underlying: aggregate Greeks across positions,
spot×vol scenario grids, and delta-gamma-vega-theta Pinvalid input: '&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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAggregated book value and Greeks.static final recordOne option position;quantityin option units (contract multiplier applied by caller).static final recordFirst/second-order attribution of a Pinvalid input: '&L' move. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddOption(OptionsBook.OptionPosition position) addOption(String label, BlackScholes.OptionType type, double strike, double expiryYears, double quantity, double impliedVol) addUnderlying(double quantity) Adds (or hedges with) the underlying; negative = short.greeks()Aggregated Greeks: options plus the underlying (delta 1 per unit).pnlExplain(double newSpot, double volShift, double timeDecayYears) Delta-gamma-vega-theta Pinvalid input: '&L' explain versus full revaluation: how much of the actual move the Greeks account for, and what is left unexplained (higher-order and cross terms).double[][]scenarioGrid(double[] spotShiftsPct, double[] volShiftsAbs) Spot×vol scenario Pinvalid input: '&L' grid (full revaluation, no time decay):grid[i][j]= Pinvalid input: '&L' at spot shifted byspotShiftsPct[i](fraction, 0.05 = +5%) and vol shifted byvolShiftsAbs[j](absolute, 0.02 = +2 vol points).doublespot()doubledoublevalue()Book value at current market (options MTM + underlying).doublevalueAt(double newSpot, double volShift, double timeDecayYears) Full revaluation at a shifted market (parallel vol shift, time decay).
-
Constructor Details
-
OptionsBook
public OptionsBook(double spot, double rate, double carry)
-
-
Method Details
-
addOption
-
addOption
public OptionsBook addOption(String label, BlackScholes.OptionType type, double strike, double expiryYears, double quantity, double impliedVol) -
addUnderlying
Adds (or hedges with) the underlying; negative = short. -
spot
public double spot() -
positions
-
underlyingQuantity
public double underlyingQuantity() -
value
public double value()Book value at current market (options MTM + underlying). -
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 Pinvalid input: '&L' grid (full revaluation, no time decay):grid[i][j]= Pinvalid input: '&L' at spot shifted byspotShiftsPct[i](fraction, 0.05 = +5%) and vol shifted byvolShiftsAbs[j](absolute, 0.02 = +2 vol points). -
pnlExplain
Delta-gamma-vega-theta Pinvalid input: '&L' explain versus full revaluation: how much of the actual move the Greeks account for, and what is left unexplained (higher-order and cross terms).
-