verify_backtest_series
Checks returns series for hidden backtest flaws: look-ahead bias, autocorrelation, regime dependence, tail risk, overfitting. Returns verdict and flagged checks.
Instructions
Run the checks a Deflated-Sharpe pass STILL misses — on the actual returns series. Catches same-bar
look-ahead, autocorrelation-inflated Sharpe (HAC), regime dependence / cherry-picked windows, drawdown &
tail fantasy, one-lucky-epoch fragility (block bootstrap), overfitting beyond n_trials (PBO), and
volatility-clustering. Returns a combined verdict + the checks that flagged. Pass positions+asset_returns
for the leakage check, turnover for cost, candidates (a matrix) for PBO.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | Yes | Your metering key — any stable string identifying you; it tracks your free-tier calls and prepaid credit balance. | |
| returns | Yes | The strategy's per-period return series (the actual numbers, not a summary). | |
| turnover | No | Optional per-period turnover — enables the breakeven-cost check. | |
| positions | No | Optional aligned position/signal series — enables the same-bar look-ahead (leakage) check. | |
| candidates | No | Optional matrix (rows = the candidate strategies you picked the winner from) — enables PBO. | |
| asset_returns | No | Optional aligned underlying-asset returns — needed with `positions` for the leakage check. | |
| periods_per_year | No | Periods per year for annualization (252 daily). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| risk | No | none / medium / high / critical — the worst flagged check (look-ahead & overfit = critical). | |
| flags | No | Names of the checks that tripped. | |
| checks | No | Per-check results (hac_sharpe, regime_stability, drawdown, bootstrap_stability, permutation, leakage, pbo, …). | |
| verdict | No | ||
| n_checks | No | ||
| survives | No | True only if NO integrity check flags. |