Expand description
The typed, open-ended market data container: the pricing context.
A Market is not a struct of fields — it is a type-safe dictionary.
Each kind of market datum is addressed by its own key type (a
MarketKey implementor), and the key pins the value type at compile
time: looking up Spot returns a Quote, looking up Vol
returns a shared Arc<VolSurface>. Heavy objects (surfaces,
curves) live behind Arc, so cloning a market for a scenario shares
everything untouched. Storage is open-ended — a new instrument that
needs a datum nobody anticipated (a correlation term structure, an FX
vol, a forecast curve) defines a new key type and inserts it; no core
code changes.
Spot("ACME") -> Quote(100.0)
Vol("ACME") -> VolSurface {...}
Discount("USD") -> YieldCurve {...}The only runtime failure mode is missing data
(RustyQLibError::MissingMarketData) — a wrong-type lookup cannot be
written, because the key’s MarketKey::Value fixes the return type.
Instruments consume a market through their own wiring (e.g.
EquityOption::npv_in),
keeping contract terms (immutable) separate from market state (shared,
bumped, repriced).
Structs§
- Depth
- Limit-order-book depth of one underlying, by symbol — the
execution-layer observable (
MarketDepth), kept separate from the pricing mark (Spot). A trading adapter publishes both and collapses the book into theSpotquote at the snapshot boundary (MarketDepth::to_quote); pricing engines never walk a ladder. Scenario shocks bumpSpotand leave depth untouched. - Discount
- Discount curve, by currency code (e.g.
"USD").Arc-shared and copy-on-write, likeVol. - Market
- A market snapshot: valuation date plus a typed store of market data, shared across a book. See the module docs for the design.
- Shock
- One shock on one factor. The how of each bump lives with the bumped
type (
VolSurface::bumped,YieldCurve::bumped); a shock only names the factor, the sizing and an optional underlying filter. - Spot
- Spot quote of one underlying, by symbol.
- Vol
- Implied volatility surface of one underlying, by symbol.
Enums§
- Bump
Mode - How a shock size is applied.
- Risk
Factor - The risk factor a shock applies to.
Constants§
- DEFAULT_
CURRENCY - Currency assumed when an instrument does not state one, so that such
instruments and hand-built markets agree on the same
Discountkey.
Traits§
- Market
Key - A typed address for one piece of market data.