Skip to main content

Is your backtest result real, or overfit? Statistical diagnostics for backtest overfitting.

Project description

skepsis

Is your backtest result real, or overfit?

ci PyPI docs

skepsis report

skepsis takes the returns of a backtested strategy — and, ideally, the returns of every variant you tried along the way — and produces statistical evidence for or against the result being luck, plus a self-contained HTML report you can hand to a PM.

pip install skepsis

Quickstart

import skepsis

result = skepsis.evaluate(
    returns,            # per-period returns of the chosen strategy
    trials=trials_df,   # T x N returns of all variants tried (optional, unlocks DSR + PBO)
    params=params_df,   # one row of parameter values per trial (optional, unlocks sensitivity)
    freq="daily",
)
print(result.summary())
result.save_html("skepsis_report.html")

More inputs unlock more diagnostics; the report states plainly which diagnostics could not run and why.

Docs: https://abhinay.github.io/skepsis · Demo: Deflating the Golden Cross

The diagnostics

Diagnostic Question it answers Source
Probabilistic / Deflated Sharpe Ratio Is the Sharpe distinguishable from zero once sample length, fat tails, and how many things you tried are priced in? Bailey & López de Prado (2012, 2014)
Probability of Backtest Overfitting (CSCV) How often does your in-sample winner land in the bottom half out-of-sample? Bailey, Borwein, López de Prado & Zhu (2015)
Stationary block bootstrap What does the Sharpe/drawdown distribution look like under resampling that preserves autocorrelation — and does a no-skill null explain it? Politis & Romano (1994); Politis & White (2004)
Parameter sensitivity Is the chosen configuration a plateau (robust) or an isolated spike (fitted to noise)?

The implementations are verified against reference values in tests/golden/ — including reproducing the published numerical example of the Deflated Sharpe Ratio paper to all four printed decimals (test_dsr_paper_example.py).

What skepsis is not

Not a backtester, not a data source, not a portfolio optimizer. It sits downstream of vectorbt, backtesting.py, zipline, or your homegrown engine, and it never silently repairs bad input: NaNs are rejected, strained assumptions are warned about, skipped diagnostics say why.

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skepsis-0.1.0.tar.gz (405.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skepsis-0.1.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file skepsis-0.1.0.tar.gz.

File metadata

  • Download URL: skepsis-0.1.0.tar.gz
  • Upload date:
  • Size: 405.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for skepsis-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dee0248e6e69c15702aa811dca09e5e18e95b98ef208ef83dd177549f096e8f4
MD5 08e96913cfae8d2f5ad089292b420923
BLAKE2b-256 613a7135f1bbf567e22520c2398178e0c2133cb81a86ee8b1c36e2cfa299f1dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for skepsis-0.1.0.tar.gz:

Publisher: release.yml on abhinay/skepsis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skepsis-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: skepsis-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for skepsis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a63a62183a66a98d1f7f5a36f2f325d7f8a02ca1235caa5d38f78fdc5e60a16
MD5 c0e821ea971ee1ddad7a2c1bbd03af2d
BLAKE2b-256 27ccd6f0a803b9c32e4e1bd8297673ee471c1885b245cad0942693db7f970674

See more details on using hashes here.

Provenance

The following attestation bundles were made for skepsis-0.1.0-py3-none-any.whl:

Publisher: release.yml on abhinay/skepsis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page