strategy_risk
Concept Overview
Section titled “Concept Overview”AFML Chapter 15 asks a question portfolio risk does not: given the precision, payout asymmetry and bet frequency this strategy actually achieved, what is the probability that the process fails to reach its Sharpe target? The symmetric and asymmetric helpers invert the Sharpe relation for whichever variable you are solving for — implied precision, implied frequency — and estimate_strategy_failure_probability bootstraps the realised bet outcomes, fits a KDE to the resulting precision distribution, and reports the mass falling below the precision the target Sharpe requires.
When to Use
Section titled “When to Use”Use it at strategy-approval time and then as a standing monitor: the implied precision threshold p* is a concrete kill criterion, and a strategy whose realised precision drifts toward it is failing before its PnL says so. Analyse the manager-controlled inputs — the payouts and the bet count — separately from market-determined precision, because the first are design choices and the second is not. This is strategy viability; use risk_metrics for holdings and tail risk.
Mathematical Foundations
Section titled “Mathematical Foundations”Symmetric Sharpe
Section titled “Symmetric Sharpe”
Asymmetric Sharpe
Section titled “Asymmetric Sharpe”
Strategy Failure Probability
Section titled “Strategy Failure Probability”
Usage Examples
Section titled “Usage Examples”Estimate strategy-failure probability from realized bets
Section titled “Estimate strategy-failure probability from realized bets”use openquant::strategy_risk::{estimate_strategy_failure_probability, StrategyRiskConfig};
let outcomes = vec![0.005, -0.01, 0.005, 0.005, -0.01, 0.005, 0.005, -0.01];let report = estimate_strategy_failure_probability( &outcomes, StrategyRiskConfig { years_elapsed: 2.0, target_sharpe: 2.0, investor_horizon_years: 2.0, bootstrap_iterations: 10_000, seed: 7, kde_bandwidth: None, },)?;
println!("p*: {:.4}", report.implied_precision_threshold);println!("failure (KDE): {:.2}%", 100.0 * report.kde_failure_probability);API Reference
Section titled “API Reference”Python API
Section titled “Python API”strategy_risk.sharpe_symmetricstrategy_risk.implied_precision_symmetricstrategy_risk.implied_frequency_symmetricstrategy_risk.sharpe_asymmetricstrategy_risk.implied_precision_asymmetricstrategy_risk.implied_frequency_asymmetricstrategy_risk.estimate_strategy_failure_probability
Rust API
Section titled “Rust API”sharpe_symmetricimplied_precision_symmetricimplied_frequency_symmetricsharpe_asymmetricimplied_precision_asymmetricimplied_frequency_asymmetricestimate_strategy_failure_probabilityStrategyRiskConfigStrategyRiskReport
Risk Notes and Caveats
Section titled “Risk Notes and Caveats”- Inputs under manager control ({pi_minus, pi_plus, n}) should be analyzed separately from uncertain market precision p.
- Use this module for strategy-level viability and probability-of-failure diagnostics; use
risk_metricsfor portfolio-tail and drawdown risk.