Class HedgeOptimizer

java.lang.Object
com.quantfinlib.crb.HedgeOptimizer

public final class HedgeOptimizer extends Object
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). Every 50 sweeps the solver tries to finish exactly: it solves the optimality conditions on the current support and sign pattern and accepts the result if the subgradient condition holds off the support. A ridge of 1e-12·tr(G)/m on the instrument Gram matrix makes the solution unique for collinear instruments. Research lane, static.

  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    hedge(double[] exposures, double[][] covariance, double[][] loadings, double[] costPerUnit, double costWeight)
    Computes hedge notionals for the given factor exposures.
    static double[]
    residual(double[] exposures, double[][] loadings, double[] h)
    Post-hedge factor exposures e + L·h.
    static double
    risk(double[] exposures, double[][] covariance)
    Portfolio stdev of an exposure vector under Σ — the risk being cut.

    Methods inherited from class Object

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

    • hedge

      public static double[] hedge(double[] exposures, double[][] covariance, double[][] loadings, double[] costPerUnit, double costWeight)
      Computes hedge notionals for the given factor exposures.
      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.