Package com.quantfinlib.crb
A CRB exists because two desks paying the street to shed opposite
risks is money burned twice. The flow here: every instrument —
cash equities, listed equity options, FX spot, FX swaps, NDFs, FX
options — decomposes into a COMMON factor space at booking
(CentralRiskBook: equity deltas per
symbol, currency-level FX deltas so spot/swap/NDF/option legs net,
dollar gamma and vega per underlying, forward-points risk).
Incoming flow is priced with an inventory skew
(SkewedQuoter) and either internalized
or routed (InternalizationEngine:
risk-reducing flow earns price improvement, risk-adding flow is
warehoused only inside the limit). The residual is watched by
CrbAutoHedger (band breach → hedge the
EXCESS only) through HedgeOptimizer
(minimum variance with an L1 cost term — expensive instruments get
exactly zero) over a CrbHedgeUniverse
(the loadings-matrix builder), and hedge orders route through
CrbRouter: internal cross first (the
book is the firm's best dark pool), adverse-selection-priced dark
venues second, lit last. CrbPnlLedger
keeps the score: did the captured spread pay for the hedging?
Everything is deterministic, single-threaded, research/warm lane
(interval cadence — the ULL lanes live in trading and
marketdata). CentralRiskBook.report hands the netted
book to VarEngine for VaR/ES and prices
the diversification benefit of running risk centrally.
-
ClassDescriptionThe central risk book — one netted view of the firm's market risk across desks and products.The central risk book's hedging loop: per-factor exposure BANDS, a cost-aware hedge when breached, and a cooldown so the book does not chase its own hedges.One instrument's hedge instruction.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).The central risk book's ECONOMICS ledger — the number the desk head actually asks for at the close: did the spread we captured by internalizing pay for the hedging we did?The central risk book's order router — internal cross first, dark pools second, lit last, each leg priced honestly: Internal — crossing against the book's own offsetting inventory costs ZERO bps and leaks nothing: the CRB itself is the firm's first and best dark pool.Where the notional went.A dark venue as the router sees it.Dense integer ids for risk-factor names — theSymbolRegistrypattern applied to the central risk book's factor space, so exposure arithmetic runs over primitive arrays while the factor names stay readable (EQ:AAPL,CCY:EUR,FXVEGA:EURUSD).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".The internalize-or-route decision — the economics that justify a central risk book's existence.Where one flow went, and what the client got for it.Inventory-skewed two-way pricing — the central risk book's quoting face.A shaded two-way price.