Skip to main content

Module market

Module market 

Source
Expand description

Binding equity instruments to a shared Market: the pricing context, separated from contracts.

Instruments constructed from JSON or the builder embed the market they were built with — convenient for a stateless pricing service, but a desk wants the other shape too: one market snapshot shared across a book, bumped once, and the whole book repriced under it:

let market  = book.snapshot_market();              // typed store: Spot/Vol/Discount
let crash   = market.bumped(&scenario.shocks)?;    // -20% spot, +10 vol pts, ...
let pnl     = book.npv_in(&crash)? - book.npv_in(&market)?;

The store itself (core::market) holds real objects — Quote spots, VolSurfaces, YieldCurves — keyed by symbol and currency, and each object owns its own bump semantics. This module is the equity wiring between the store and the instrument’s bound market (EquityMarketData, the market field engines read): snapshotting a bound market into a store, and rebinding an instrument to a store for repricing on its own engine (full revaluation; Monte Carlo keeps its seed, so bumped-minus- base differences are free of sampling noise). The TOML stress runner (risk::stress) is a consumer of these primitives.

Dividend yield, borrow cost and discrete cash dividends live on the bound EquityMarketData but are not yet keyed in the store; they gain keys when a consumer needs to bump them.