Class HedgeOptimizer
java.lang.Object
com.quantfinlib.crb.HedgeOptimizer
Cost-aware minimum-variance hedging of the central risk book's
residual — the question is never "how do we flatten this" (sell
everything) but "what is the CHEAPEST basket of liquid instruments
that takes the risk below the limit". Minimizes
(e + L·h)' Σ (e + L·h) + λ · Σᵢ cᵢ·|hᵢ|over hedge notionals
h: e the factor exposures,
L each instrument's factor loadings, Σ the factor
covariance, cᵢ the instrument's all-in cost per unit notional
(spread + expected impact — a KylesLambda estimate slots in
directly), λ the risk/cost trade-off.
Solved by cyclic coordinate descent with the exact soft-threshold
update — deterministic, no external optimizer, and the L1 term does
what a hedging desk actually wants: instruments whose marginal risk
reduction is worth less than their cost get EXACTLY zero, not a dusty
small position. λ = 0 recovers the closed-form minimum-
variance hedge (the tests pin that against the normal equations).
Research lane, static.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[]hedge(double[] exposures, double[][] covariance, double[][] loadings, double[] costPerUnit, double costWeight) static double[]residual(double[] exposures, double[][] loadings, double[] h) Post-hedge factor exposures e + L·h.static doublerisk(double[] exposures, double[][] covariance) Portfolio stdev of an exposure vector under Σ — the risk being cut.
-
Method Details
-
hedge
public static double[] hedge(double[] exposures, double[][] covariance, double[][] loadings, double[] costPerUnit, double costWeight) - Parameters:
exposures- factor exposures e (length n)covariance- n×n factor covariance Σloadings- loadings[f][i] — factor f exposure created by one unit of instrument i (n × m)costPerUnit- cᵢ ≥ 0 per unit |notional| (length m)costWeight- λ ≥ 0 — 0 is pure minimum variance- Returns:
- hedge notionals h (length m), signed
-
residual
public static double[] residual(double[] exposures, double[][] loadings, double[] h) Post-hedge factor exposures e + L·h. -
risk
public static double risk(double[] exposures, double[][] covariance) Portfolio stdev of an exposure vector under Σ — the risk being cut.
-