Skip to main content

Module stress

Module stress 

Source
Expand description

Stress MtM: scenario revaluation of an options book driven by a TOML shock configuration.

A config declares named scenarios, each a list of shocks on risk factors (spot, vol, rate, time) with relative or absolute sizing and an optional underlying filter:

[[scenarios]]
name = "equity_crash"

[[scenarios.shocks]]
factor = "spot"
mode = "relative"
size = -0.20            # spot down 20%

[[scenarios.shocks]]
factor = "vol"
mode = "absolute"
size = 0.10             # implied vol up 10 points
underlying = "ACME"     # only this name (omit or "*" for all)

[[scenarios.shocks]]
factor = "rate"
mode = "absolute"
size = 0.005
tenors = [1.0, 2.0]     # key-rate: bump only this part of the curve
# shifts = [0.005, 0.003]  # optional per-tenor sizes (default: size)

[arbitrage]             # optional guard on bumped curves
policy = "warn"         # allow | warn (default) | reject
forward_floor = 0.0

The book’s market is snapshotted once into a typed Market store, each scenario bumps it (Market::bumped — every risk factor object performs its own bump, shocks apply in order, relative shocks scale the current level), and every position reprices fully on its own engine under the bumped snapshot (EquityOption::npv_in). Results come back per trade and aggregated per scenario, with the aggregation identity portfolio = sum(trades) exact by construction.

The time factor is an absolute horizon in days (theta-inclusive stresses); dividend/carry shocks are not yet supported by the repricer and are rejected at parse time by omission from the enum.

Re-exports§

pub use crate::core::market::BumpMode;
pub use crate::core::market::RiskFactor;
pub use crate::core::market::Shock;

Structs§

ArbitrageCheck
The no-arbitrage guard applied to every bumped curve of every scenario.
ScenarioResult
One scenario’s book-level result with the per-trade breakdown.
StressConfig
The whole stress configuration (one or more scenarios).
StressScenario
A named collection of shocks applied together.
TradeStress
One trade’s stress result.

Enums§

ArbitragePolicy
What to do when a bumped scenario curve implies a forward rate below the configured floor (see min_forward).

Functions§

stress_mtm
Run every scenario in config over the book, through the pricing context: the book’s market is snapshotted once, each scenario bumps it (Market::bumped), the bumped curves pass the config’s no-arbitrage guard (ArbitrageCheck), and every position revalues fully on its own engine under the bumped snapshot. Reported per trade and aggregated; portfolio = sum(trades) is exact by construction. Errors on a malformed shock, a rejected arbitrage check, or a position the captured market cannot price.