Skip to main content

Module store

Module store 

Expand description

The stored market, the lift that turns it into a mode view, and the risk read-back that comes off the lift.

§A market is lifted, never armed

MarketContext is passive, immutable, shareable data — term structures, vol surfaces, observations and model marks, four families by shape, all holding f64. Nothing in it knows about a tape. Taking risk against it is MarketContext::lift — one flat vector of the mode’s scalars, registered once, handed to a MarketView that borrows both the vector and the storage.

That replaces arming. There is no second registry of duplicated market objects, no lock guarding one, no per-curve deep copy, and nothing to de-arm afterwards: the handles live in the vector the caller owns, so dropping the view is the whole of the cleanup and the stored market was never touched. Two threads may lift the same market at the same time, because neither writes to it.

§One vector, one order

The lift lays every free parameter of every stored input end to end, in a fixed order the market itself defines. A Span records where each input’s parameters begin and how many there are, and the read-back walks the same spans to label each adjoint. One walk, so a risk row cannot be labelled with a pillar the lift installed somewhere else.

§The pass

risk_with is the twelve lines the design asked for: one forward pass, one seed, one reverse sweep, one collection. It takes the tape by reference so a caller valuing repeatedly reuses one allocation.

Structs§

BuildRecord 🔒
How the market was, or would be, built. Addressed by the keys the pricing seam declares, and contributing no lifted parameter: never read by the lift, never compared.
CreditEntry 🔒
An entity’s credit data as the market stores it.
DegenerateHub
A triangulated discount declared through a hub that is one of its key’s own currencies, which collapses the triangle onto the key itself.
IdStore 🔒
A family’s inputs sorted by identity.
LiftedMarket
A market’s parameters lifted into one mode, with the layout that labels them.
MarketContext
The stored market: passive, immutable, shareable.
MarketState 🔒
The stored state a lift reads, as four families by shape — what the machinery branches on, not the asset class, which stays a label derived from each input’s risk axis. The walk is the families in this order, each family in its identity’s own order.
MarketView
A MarketContext resolved at one mode.
Observations 🔒
The observed inputs: facts already printed, with no identity to key a map by and nothing to calibrate. A struct of two fields rather than a map, so each yields its span unconditionally.
PinnedCurve
A curve on its way into a market, together with whatever it knows about how it was built.
PinnedInflation
An inflation curve on its way into a market, with whatever ladder it carries — the third pin, shaped like PinnedCurve and PinnedSurvival.
PinnedSurvival
A survival curve on its way into a market, with whatever ladder it carries — the credit twin of PinnedCurve, so a CalibratedSurvival pins the way a Calibrated does and a bare curve pins with no ladder.
ProvenanceMismatch
A ladder attached to a curve it does not describe.
ReferenceDateMismatch
A curve was bound to a market that is as of another date.
Snapshot 🔒
One date’s snapshot, set aside while the market is at another date: the state as of that date (its fixings excepted, which live in the history), the ladders and refits behind its curves, its misdated record, and the data it was fetched from.
Span 🔒
Where one input’s parameters sit in the lifted vector.

Enums§

CurveIdRef 🔒
A curve key by reference — what a lookup compares against, so resolving a trade owns no string to name a curve the instrument already names.
Diagnostics
What a product’s valuation resolved to on a market, one variant per product that states it: the inputs and parts its value is built from.
Input 🔒
One stored input as the lift reads it, with the key it is stored under.
InputId 🔒
The input a span of the lifted vector came from: the family identity itself, owned by the span, plus the one span a family contributes beside its identity — a survival term’s recovery.
Mark 🔒
One model mark as the store holds it: the payload a MarkId maps to. A mark is a parameter someone chose rather than a curve calibrated from instruments or a fact already printed — a correlation, a floor, a degree of freedom, a watched scalar — and the identity decides its shape: a base correlation is a curve over detachments, a CMS spread correlation a flat mark or a term structure, a copula’s degrees of freedom a pair, the rest one number.
MarkIdRef 🔒
A mark identity by reference, for the same reason. Variants in MarkId’s order.
ProjectionKey
What a projection curve may be keyed under.
SigmaPin
The volatility MarketContext::with_hull_white pins: one flat value, or dated pieces (interval end, σ), the last extending flat beyond its date.
SourceRef 🔒
An input identity by reference — what a lookup on the resolution path compares a span against, so resolving a trade owns no key.
Term 🔒
One term structure as the store holds it: the payload a CurveId maps to. The identity’s role decides the arm — the four rate roles a rate curve, Credit a survival curve with its stated recovery, Inflation an inflation curve — which is what lets the three former stores be one map in the identity’s one order.
VolSurface 🔒
One vol surface as the store holds it: the payload a VolSurfaceId maps to. The three RateVolSurface registries — swaption, cap, bond yield — share one arm and are told apart by the identity alone, which is what lets the seven former stores be one map.
VolSurfaceIdRef 🔒
A vol surface identity by reference — what a lookup on the resolution path compares against, so resolving a trade owns no string to name a surface the instrument already names. Variants in VolSurfaceId’s order, so the two compare alike.

Functions§

at_the_money 🔒
cms_spread_correlation_labels 🔒
A CMS spread correlation’s parameter labels: one keyed by the pair alone for a flat mark, one per pillar for a term structure, one per (expiry, strike) node for a surface.
copula_dof_labels 🔒
A credit index’s double-t degrees-of-freedom labels: the factor’s, then each name’s, in the order the pair lifts.
curve_date 🔒
The date a rate curve is a curve as of — what a bind checks it against.
declared_needs 🔒
The curves a declaration cannot be valued without, as their keys: every curve it names except a repo basket’s, whose missing tiers fall back to the discount curve by design.
extend_family 🔒
Appends family’s parameters to out in parameter_owners order — the order view_with consumes them — flattening a composition through the owner visit so a market of leaves fills one vector, not one per curve.
family_labels 🔒
family’s parameter labels as risk-vector keys under id.
family_refusal 🔒
family’s refusal, if any, named by the id id builds — built only on refusal, so the common case owns no string.
from_labels 🔒
One curve’s labels turned into risk-vector keys under id.
inflation_date 🔒
The date an inflation curve is a curve as of.
inflation_vol_labels 🔒
One inflation vol surface’s node labels, in parameter order: YoY nodes or, for a zero-coupon CPI surface, CPI nodes.
mark_labels 🔒
A mark’s parameter labels, under the identity it is stored by.
npv
The value of one book against market, with no derivatives taken.
on_axis 🔒
A registry whose reader names one kind of strike coordinate takes a smile quoted on that axis and no other. A swaption knows its forward and so reads spreads; a cap knows only its strike.
positive_semidefinite 🔒
Whether a symmetric matrix is positive semi-definite, by an LDLᵀ walk that allows a zero pivot only on a zero remainder.
refuse_spread 🔒
Refuses a repo spread pinned as a rate curve: it is pinned over its base with with_repo_spread, and read alone it discounts off the spread.
risk_with
The risk pass. One forward pass, one seed, one reverse sweep, one collection.
sabr_labels 🔒
A SABR surface’s node labels under registry and currency.
smile_store 🔒
A registry whose read names no rate strike takes a surface quoted at the money; a smile there would silently price off one of its columns. A rate smile as the store holds it.
survival_date 🔒
The date a survival curve is a curve as of.
vol_labels 🔒
A vol surface’s node labels, under the identity it is stored by: the identity, not the payload, decides which node key a RateVolSurface reports, because three registries share that one grid type.

Type Aliases§

TermStore 🔒
Every term structure in one store, sorted by curve identity.