Tathagat Agrawal

Strategy Backtester

An event-driven backtesting engine written from scratch, with slippage and cost modelling and lookahead-bias prevention enforced by tests.

August 2026 · Complete · Source on GitHub

The problem

Backtesting libraries hide the details that decide whether a backtest can be trusted: when an order fills, at what price, what it costs, and whether the strategy accidentally used tomorrow’s data. I wrote an engine from scratch, without backtrader, zipline or backtesting.py, to get each of those details right and test them.

What I built

Both strategies were validated end to end on about nine months of real BTC/USDT hourly data. The design is documented in eight short design documents in the repository, from the event system to execution and analytics.

Built with

Backtesting engines and execution modelling, Performance and risk metrics (Sharpe, drawdown, deflated Sharpe), Market data (yfinance, CCXT, NSE), pandas and NumPy, Testing and CI (pytest, GitHub Actions), Command-line and terminal apps (Typer, Rich, Textual), Visualisation (Matplotlib, Seaborn, Power BI), Python