Class GreekHedger
java.lang.Object
com.quantfinlib.hedging.GreekHedger
Greek-neutralization: solves the hedge quantities that flatten a
portfolio's option Greeks using available hedge instruments — the standard
delta-gamma and delta-gamma-vega hedging recipes, plus a general linear
solver for arbitrary greek/instrument combinations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordPer-unit Greeks of a hedge instrument (the underlying is delta=1, gamma=0, vega=0). -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]deltaGammaHedge(double portfolioDelta, double portfolioGamma, double optionDelta, double optionGamma) Delta-gamma hedge with the underlying plus one option: returns[underlyingQty, optionQty]that zero both Greeks.static double[]deltaGammaVegaHedge(double portfolioDelta, double portfolioGamma, double portfolioVega, GreekHedger.Instrument option1, GreekHedger.Instrument option2) Delta-gamma-vega hedge with the underlying plus two options: returns[underlyingQty, option1Qty, option2Qty].static double[]neutralize(double[] portfolioGreeks, GreekHedger.Instrument[] instruments) General case: solves per-instrument quantities so that the summed instrument Greeks exactly offset the portfolio Greeks.static double[]residualGreeks(double[] portfolioGreeks, GreekHedger.Instrument[] instruments, double[] quantities) Residual portfolio Greeks after applying the hedge quantities (for verification).
-
Method Details
-
deltaGammaHedge
public static double[] deltaGammaHedge(double portfolioDelta, double portfolioGamma, double optionDelta, double optionGamma) Delta-gamma hedge with the underlying plus one option: returns[underlyingQty, optionQty]that zero both Greeks. -
deltaGammaVegaHedge
public static double[] deltaGammaVegaHedge(double portfolioDelta, double portfolioGamma, double portfolioVega, GreekHedger.Instrument option1, GreekHedger.Instrument option2) Delta-gamma-vega hedge with the underlying plus two options: returns[underlyingQty, option1Qty, option2Qty]. -
neutralize
General case: solves per-instrument quantities so that the summed instrument Greeks exactly offset the portfolio Greeks. The number of instruments must equal the number of Greeks (portfolioGreeks = [delta, gamma, vega][..count]), and the instrument Greeks must be linearly independent. -
residualGreeks
public static double[] residualGreeks(double[] portfolioGreeks, GreekHedger.Instrument[] instruments, double[] quantities) Residual portfolio Greeks after applying the hedge quantities (for verification).
-