My strategy looked fine in the backtest and lost money live.\n\nIf you've done this for a while, you already know the suspects. What surprised me is how mechanical they are — each one is a specific, checkable defect, not a vague "the market changed":\n\n- Look-ahead — signals silently shifted onto future bars.\n- A ledger that doesn't balance — cash/position conservation breaks, and the PnL is fiction.\n- Fees and funding counted zero times (or twice) — the cost model quietly drops out.\n- Exit logic that scans the whole window instead of the current bar.\n\nI packaged those four checks into a small, dependency-free Python toolkit (no numpy, no pandas):\n\n
\npip install backtest-audit-kit\n
\n\n- a look-ahead detector\n- ledger invariants (cash/position conservation)\n- a fee / funding double-count detector\n- mutation testing, to find blind spots in your own test suite\n\n*A worked example.* cases/ ships a real BTC backtest whose cost model was zero — reported PnL came out at roughly 5.7x the principal. But the structural problem was worse than the bug: the take-profit needed +0.08% while a round-trip taker fee is 0.10%, so every winning trade net-loses by construction. No amount of parameter tuning fixes that.\n\nRepo: https://github.com/rytjy/backtest-audit-kit\n\n**What check would you add?** I'm collecting the ones I haven't automated yet.
Backend
Source:https://dev.to/rytjy/four-ways-your-backtest-lies-and-a-dependency-free-python-kit-that-catches-them-3p8n
Four ways your backtest lies — and a dependency-free Python kit that catches them
dev.to Python0 views
PreviousFinding tense switches in a novel — and deciding which ones matterNextPull local business leads from YellowPages with Python
Related posts

The Roofline Model for LLM Inference
0dev.to Machine Learning
Deduplicate Your RAG Corpus Without Losing Its Citations
0dev.to Machine Learning

scm2cpp-learn: 44 scikit-learn estimators, same results, up to ~1000x faster
0dev.to Machine Learning
Marvell is buying Lumentum for $115B: what the optical bet means for AI cluster power, and what a fixed 4.5x exchange ratio really locks in
0dev.to Machine Learning
Terminal-Bench 2.0 vs 2.1 on Hugging Face: A 2.1 Score Is Ranked First on the 2.0 Board
0dev.to Machine Learning
How to read a failed CI log: find the first real cause in under a minute
0dev.to Tutorial