Case study · Quant Research & Intelligence
Tick-Level Backtesting Engine
High-performance Python backtesting engine for equities, forex, and crypto. Supports large datasets, custom strategies, walk-forward analysis, portfolio simulations, and performance metrics including Sharpe, drawdown, and expectancy.
- Primary Tech
- Python / Pandas
- Data Format
- HDF5 & Binary
- Target Platform
- Tick Engine
Client work under NDA. Client names, trading data, performance figures and live screens are not shown. This page describes the problem, what we built and the technology used.
The client
A team of quantitative analysts testing strategies on equities, forex and crypto.
The problem
Quantitative analysts required a robust system to backtest multi-year data with realistic slippage and commissions.
- Their bar-based backtests could not show what happened inside a bar, so fills looked better than they would be in practice.
- Slippage and commissions were added roughly at the end, or left out.
- Years of tick data were too large to load into memory or keep in CSV files.
- There was no standard report, so strategies could not be compared like for like.
Our approach
We built an event-driven backtester that replays tick data with costs built into every fill, stores data in a format that scales, and produces the same report for every strategy.
How we built it
- 1
Data layer
Tick data is stored in HDF5, split by instrument and date, and read in chunks with Pandas and NumPy, so years of data never have to be in memory at once.
- 2
Simulation engine
The engine replays bid and ask ticks in order. Buys fill at the ask and sells at the bid, with configurable slippage, commission and financing applied to each trade.
- 3
Walk-forward module
Parameters are optimised on one window and tested on the next, then the windows roll forward. In-sample and out-of-sample results are reported separately.
- 4
Portfolio simulation
Several strategies can run on shared capital, giving a combined equity curve and combined risk.
- 5
Standard report
Every run produces the same report: Sharpe ratio, maximum drawdown, expectancy and the full trade list.
How we tested it
- Simple strategies run on small samples and checked against trades calculated by hand.
- Repeat runs to confirm the same data and parameters always give the same result.
- Cost settings checked against the analysts' broker cost schedules.
What we delivered
- The engine as a Python package in the team's environment.
- Documentation and example strategies.
- Support after launch.
The result
The analysts test strategies on tick data with costs included, compare them on one report, and see in-sample and out-of-sample results side by side.
Features
- Large-scale historical datasets
- Walk-forward adaptability
- Portfolio risk simulations
- Expectancy & Sharpe metric reports
Technology
- Python
- Pandas
- NumPy
- HDF5
Start here