Backtest integrity check (deflated Sharpe + regime coverage)
backtest_integrityConfront a backtest claim with its over-optimism failure modes before trusting it. Given an annualized Sharpe + the number of configurations tried + the backtest window (YYYY-MM-DD), returns: the DEFLATED Sharpe — the expected MAXIMUM Sharpe achievable by chance grows with the trial count, so a high in-sample Sharpe is a selection artifact (Bailey & López de Prado); which CRISIS REGIMES were ABSENT from the backtest window (untested, from the historical-anchor catalogue); and a base-rate caveat. If the trial count is unknown — the usual case for an agent reasoning from a backtest — the Sharpe is flagged as not-deflatable / UNPROVEN. All inputs optional; supply as many as known. Descriptive, not advisory.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kurt | No | Kurtosis of the strategy's returns (3 = normal). | |
| skew | No | Skewness of the strategy's returns (0 = symmetric). | |
| asset | No | Asset context for the regime-coverage check (default: SPY as the equity-crisis reference). | |
| n_trials | No | Number of configurations tried before selecting this backtest — drives the deflated-Sharpe correction. Unknown → the claim is flagged UNPROVEN. | |
| frequency | No | Return observations per year (252 = daily bars). | |
| backtest_end | No | Backtest window end (YYYY-MM-DD). | |
| backtest_start | No | Backtest window start (YYYY-MM-DD) — used to detect crisis regimes the window never contained. | |
| annualized_sharpe | No | The claimed annualized Sharpe ratio of the backtest. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |