Skip to main content

Module risk

Module risk 

Source
Expand description

Risk analytics: Value-at-Risk, Expected Shortfall and the surrounding toolkit, one concern per file.

  • measures: VaR and ES — historical (empirical quantile / tail mean), parametric normal, Cornish-Fisher higher-moment corrected, and delta-normal multi-asset VaR with the exact Euler component/marginal decomposition;
  • portfolio_risk: scenario VaR/ES for an options book (EquityPortfolio) — delta-gamma-vega-theta from the aggregated Greeks and full revaluation through the book’s repricer, on shared spot/vol scenarios so their difference isolates the Taylor error;
  • volatility: realized and EWMA (RiskMetrics) estimators;
  • performance: max drawdown, Sharpe and Sortino ratios;
  • backtest: the Kupiec proportion-of-failures VaR backtest;
  • stress: TOML-configured stress MtM — named shock scenarios (relative/absolute, per-underlying) bumped into the market data and fully revalued, reported per trade and aggregated per scenario;
  • ladder: risk ladders — full revaluation on a grid of relative spot moves (ladder delta/gamma) or parallel vol shifts (ladder vega/volga) read off adjacent rungs: the non-local risk view for barrier-heavy books.

Conventions: confidence levels are one-sided (0.99), VaR/ES are positive loss amounts, and every simulation is deterministic per seed.

Re-exports§

pub use backtest::kupiec_pof;
pub use backtest::KupiecTest;
pub use ladder::spot_ladder;
pub use ladder::symmetric_moves;
pub use ladder::vol_ladder;
pub use ladder::LadderPoint;
pub use ladder::SpotLadder;
pub use ladder::VolLadder;
pub use ladder::VolLadderPoint;
pub use measures::cornish_fisher_var;
pub use measures::delta_normal_var;
pub use measures::historical_expected_shortfall;
pub use measures::historical_var;
pub use measures::parametric_expected_shortfall;
pub use measures::parametric_var;
pub use measures::DeltaNormalVar;
pub use performance::max_drawdown;
pub use performance::sharpe_ratio;
pub use performance::sortino_ratio;
pub use portfolio_risk::delta_gamma_var;
pub use portfolio_risk::full_revaluation_var;
pub use portfolio_risk::PortfolioRisk;
pub use portfolio_risk::RiskConfig;
pub use stress::stress_mtm;
pub use stress::ArbitrageCheck;
pub use stress::ArbitragePolicy;
pub use stress::BumpMode;
pub use stress::RiskFactor;
pub use stress::ScenarioResult;
pub use stress::Shock;
pub use stress::StressConfig;
pub use stress::StressScenario;
pub use stress::TradeStress;
pub use volatility::ewma_volatility;
pub use volatility::realized_volatility;

Modules§

backtest
VaR backtesting: the Kupiec proportion-of-failures (POF) test.
ladder
Spot risk ladders: the desk risk slide.
measures
Value-at-Risk and Expected Shortfall in the three standard flavors: historical (empirical), parametric normal (with a Cornish-Fisher higher-moment correction), and delta-normal for multi-asset books.
performance
Performance and path-risk statistics: drawdowns and risk-adjusted return ratios.
portfolio_risk
VaR and Expected Shortfall for an options book (EquityPortfolio), by scenario simulation over the underlying and its implied volatility:
stress
Stress MtM: scenario revaluation of an options book driven by a TOML shock configuration.
volatility
Volatility estimation from return series: realized (close-to-close) and EWMA (RiskMetrics).