backtest-reality-check
backtest-reality-check
An MCP server that tells you whether your backtest survives its own statistics.
Point any MCP client at it and ask "is my backtest real?". It answers with arithmetic — deflated Sharpe, minimum track record length, multiple-testing correction, fill realism — using the checks professional quant research applies and hobby trading bots almost never do.
No market data. No API keys. No broker connection. It cannot recommend a trade and has nothing to sell. It can only ever tell you your number is weaker than you think, or that you can't tell yet. Those are the only two honest answers available.
▶ 60-second demo — the simulation, the maths, and the tool failing on my own dead bot.
Why it exists
I built a sports-betting engine. The backtest reported a Sharpe ratio of 8.61. It went 0 for 38 live.
Two things were wrong, and only one of them is the famous one:
Overfitting. I'd tried ~25 variants and kept the best. Nobody counts that.
Broken data. The P&L was mis-computed and the fills were at prices the market never offered — 25.5% of them better than anything actually available.
This tool catches both, with two different detectors, because they are different failures and a Sharpe ratio can only see one of them.
Related MCP server: alphaassay/mcp
The honest limitation, stated up front
Deflation catches overfitting and luck. It cannot detect broken data.
Run my own dead bot through check_backtest — Sharpe 8.61, 0.3 years, 25 trials —
and it returns SURVIVES at 99.4%. Because a Sharpe that high genuinely is
extraordinary if the returns are real. Mine weren't.
That is why check_fills exists. A backtest must pass both.
The five tools
Tool | Question it answers |
| Does your Sharpe survive multiple-testing correction? |
| What does the best of N edgeless strategies score over this sample? |
| How many years before this Sharpe is distinguishable from zero? |
| Can your sample even detect the edge you claim? |
| Are your fills earnable, or better than the market ever offered? |
The input people omit is the trial count — how many variants you tried before settling on this one. Every threshold, lookback and filter you swapped counts. It is the number that decides the answer, and almost nobody reports it.
Install
"mcpServers": {
"backtest-reality-check": {
"command": "python3",
"args": ["/absolute/path/to/backtest-reality-check/src/server.py"]
}
}Pure standard library. No dependencies, no build step, Python 3.8+.
Try it
> check_backtest --sharpe 2.13 --years 1 --trials 34
noise alone at 34 trials -> Sharpe 2.13
>>> FAILS — your Sharpe is at or below what pure noise producesThirty-four variants over one year makes a Sharpe of 2.13 the expected result of strategies with no edge whatsoever. That is the whole idea.
Some reference points from how_long_to_prove:
Sharpe | Years of daily data before it's distinguishable from zero |
1.5 | 1.2 |
1.0 | 2.7 |
0.7 | 5.5 |
0.5 | 10.8 |
0.35 | 22 |
Verification
The maths is checked against published values, and these are hardcoded as tests:
MinTRL at SR 1.0 → 2.71 years
Max trials for SR 1.0 over 5 years → 45
Over 2 years → 7
E[max Sharpe] at N=45, 5 years → 1.00
python3 tests/test_anchors.pyA bug I shipped and caught with exactly these:
expected_max_sharpefirst returned the raw order-statistic term with no sample-length scaling, making the bar independent of backtest length so short backtests wrongly passed. Under the null the per-observation Sharpe has SD ≈ 1/√T, so the annualised benchmark ismax_z / √years. My own tool failed its own sanity check.
Sources
Bailey & López de Prado, The Deflated Sharpe Ratio (JPM 2014) and The Sharpe Ratio Efficient Frontier (J. Risk 2012); Bailey, Borwein, López de Prado & Zhu, Pseudo-Mathematics and Financial Charlatanism (Notices of the AMS, 2014); Harvey, Liu & Zhu (RFS 2016) for the multiple-testing hurdle.
Licence
MIT. Use it, fork it, and please do run it on mine.
This server cannot be installed
Maintenance
Related MCP Servers
- Alicense-qualityCmaintenanceLocal-first backtesting engine with built-in overfitting detection (PBO, deflated Sharpe, bootstrap CI, walk-forward) and a native MCP server for AI agents to validate trading strategies.Last updated3Apache 2.0
- AlicenseAqualityAmaintenanceMost trading signals are noise. AlphaAssay puts them on trial — deflated Sharpe, out-of-sample, leakage forensics — and returns signed pass/fail verdicts anyone can verify. Methodology audits, not investment advice.Last updated171Apache 2.0
- AlicenseAqualityAmaintenanceA local, read-only MCP server (plus CLI) over your own stock/ETF transaction log. A deterministic core computes drawdown-first risk with bootstrap confidence intervals and validates targets with walk-forward verdicts. The assistant narrates, but the number fence makes it structurally impossible for the model to produce a figure.Last updated1081AGPL 3.0
- Alicense-qualityBmaintenanceVerify a number before an agent asserts it — a Deflated Sharpe Ratio for backtest, plus eval-gap, subset-win, and judge-bias checks, with signed receipts anyone can verify offline.Last updated1MIT
Related MCP Connectors
Deterministic pre-execution audit for trading agents. PASS/WAIT/FAIL, reproducible verdict_hash.
Validated trading edges across futures, equities, crypto. Live signals, full audit trail.
Crypto backtesting & Bitcoin cycle analytics. Point-in-time, DSR-corrected, look-ahead-aware.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/maximdakulinin-boop/backtest-reality-check'
If you have feedback or need assistance with the MCP directory API, please join our Discord server