Class CrbHedgeUniverse
java.lang.Object
com.quantfinlib.crb.CrbHedgeUniverse
The hedge-instrument universe, aligned to a book's factor registry —
because hand-assembling
loadings[factor][instrument] is the
most error-prone step in the whole hedging workflow (one transposed
index and the optimizer confidently hedges the wrong thing).
Each instrument declares what ONE UNIT of its notional does to the
factor space, in the same conventions CentralRiskBook books
with:
addSingleFactor(java.lang.String, java.lang.String, double)— an instrument that is 1-for-1 one factor: an index future ontoEQ:<index>(the covariance carries its correlation to the single names — the regression hedge falls out of the optimizer, not out of a beta table), a variance swap ontoEQVEGA:<sym>, an FX vol trade ontoFXVEGA:<pair>;addFxForward(java.lang.String, java.lang.String, double, double)— one unit of base notional loadsCCY:<base>+1 andCCY:<quote>−rate, exactly like a booked spot/forward — the natural hedge for the currency legs that spot, swaps, NDFs and option deltas net into;add(java.lang.String, double, java.lang.String[], double[])— anything else, factor names and per-unit loadings side by side.
Factors named here are REGISTERED on the shared registry if new
(a hedge-only factor simply has zero book exposure), and
loadings() materializes the matrix at the registry's
CURRENT size — build it after all booking and adding is done, and
feed it straight to HedgeOptimizer/CrbAutoHedger
with costs(). Research lane, single-threaded.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA general instrument: per-unit loadings onto named factors.addFxForward(String name, String pair, double rate, double costPerUnit) An FX forward/spot hedge onpair: one unit of base notional loads the two currency legs exactly as a booked trade would.addSingleFactor(String name, String factor, double costPerUnit) An instrument that is one unit of exactly one factor.double[]costs()Per-unit costs aligned withloadings()columns.double[][]loadings()The loadings matrix [factor][instrument] at the registry's CURRENT size — call after all booking/adding, alongsidecosts().name(int instrument) Instrument name for aCrbAutoHedger.HedgeOrder.instrument()index.intsize()
-
Constructor Details
-
CrbHedgeUniverse
- Parameters:
registry- the book's registry —book.factors()
-
-
Method Details
-
addSingleFactor
An instrument that is one unit of exactly one factor. -
addFxForward
An FX forward/spot hedge onpair: one unit of base notional loads the two currency legs exactly as a booked trade would. -
add
A general instrument: per-unit loadings onto named factors. -
loadings
public double[][] loadings()The loadings matrix [factor][instrument] at the registry's CURRENT size — call after all booking/adding, alongsidecosts(). -
costs
public double[] costs()Per-unit costs aligned withloadings()columns. -
name
Instrument name for aCrbAutoHedger.HedgeOrder.instrument()index. -
size
public int size()
-