Back to Projects
Bitcoin Backtest Lab
A local BTC/USDT research and backtesting workbench running on real Binance data

Project Summary
A local, single-user BTC/USDT research environment with a Turkish interface. It uses Binance’s public market data, needs no API key and sends no real orders. The aim is to make every assumption that shapes a strategy’s result (costs, slippage, order timing, data gaps) visible and testable.
Features
- Live prices and candlestick charts over Binance WebSocket, with a 30-second REST fallback if the connection drops
- Six timeframes from one minute to one day; paged history download by date range, gap checks and a SQLite cache
- Built-in strategies: SMA crossover, Wilder RSI mean reversion and Donchian channel breakout
- A rule editor with AND/OR groups for defining candle patterns without code
- Python Strategy Workshop: strategies written as on_candle(candles, state) run in a separate process with time and size limits
- Net return versus buy-and-hold, maximum drawdown, win rate, profit factor and annualised Sharpe; side-by-side report comparison and CSV export
- JSON backups carrying every candle, report and template, restored in a single SQLite transaction
Backtest Methodology
- Only closed candles are used; a signal produced at one close is executed at the next candle’s open.
- Buys fill higher and sells lower by the slippage amount; commission is charged in both directions.
- If stop-loss and take-profit are both hit within one candle, the stop-loss is processed first (the conservative assumption).
- Liquidity, partial fills and market impact are not modelled; these limits are stated plainly in the interface and documentation.
Testing
The calculation engine is a module independent of the interface. Vitest covers the engine, candle rules, storage, the Binance client and the Python runner with 78 unit tests; Playwright runs end-to-end browser tests for backtests, report persistence, CSV downloads and the mobile layout.
Gallery
Technologies Used
TypeScriptReactExpressSQLitePythonBinance APILightweight ChartsVitestPlaywright