Skip to main content

compute_extended_risk_grid_from_snapshot

Function compute_extended_risk_grid_from_snapshot 

Source
pub fn compute_extended_risk_grid_from_snapshot(
    snapshot: &PortfolioMarginSnapshot,
    market_state: &PortfolioMarginMarketState,
) -> Result<ExtendedRiskGrid, MarginError>
Expand description

Compute per-instrument and aggregate scenario PnL rows for a snapshot.

Uses PortfolioMarginMarketState scenarios and underlying market inputs. Returns MarginError for missing option state or decimal values that cannot be represented for grid math. Empty snapshots return an empty instrument set with zero aggregate PnL across the configured scenarios.