Most backtests are too kind
A backtest replays a trading strategy over historical prices to see how it would have done. The problem is that small, reasonable-looking shortcuts in how trades are simulated add up. A strategy can look profitable on screen and lose money live, simply because the simulation was more generous than the market.
The goal of this project was the opposite: an engine that is pessimistic wherever the data is uncertain, and that reports every assumption it had to make, so a result can be trusted or thrown out with confidence.
What we built
An event-driven backtest engine
- No lookahead. Trades enter at the open of the bar after a signal, never at the price that generated the signal.
- Honest intrabar resolution. When one bar touches both the stop and the target, the engine checks 1-minute data to see which came first. If it still can’t tell, it assumes the stop, and counts how often that happened.
- One position at a time, with no pyramiding or re-entry on the same signal, so results reflect the strategy rather than position stacking.
Realistic fills and costs
- Trading fees and funding payments are modelled on every trade, not bolted on at the end.
- Limit orders that never fill are tracked, so missed trades show up in the numbers instead of silently disappearing.
- Gaps are handled properly. If price jumps straight through an order, the fill is recorded at a price the market actually traded.
Live execution with risk controls
- A live market feed, risk checks and order execution with automatic retries.
- Position state is tracked and reconciled against the exchange, so the software’s view of its positions matches reality.
Tested, documented and packaged
- An automated test suite pins the engine’s behaviour. When a flaw in the fill model was found, it was written up and locked down with a test so it can’t come back.
- A dashboard for reviewing results and a packaged Windows desktop app for day-to-day use.
We don’t publish trading performance for this project, and we never promise returns. The work here is the engineering: software that measures a strategy honestly, whatever the answer turns out to be.
Built with
- Python
- NumPy
- Parquet
- pytest
- YAML config
- PyInstaller
Want the detail on why these problems matter? Read why most trading backtests lie.