An open-source Python backtester that models honest taker fees and funding, refuses lookahead, checks liquidations, and replays every trade bar-by-bar in an interactive HTML chart. Historical klines and funding come straight from CryptoDataAPI.
The reasons a strategy looks great on a chart and dies live are almost always the same three. This engine is built to close all three gaps by default.
Your strategy's on_bar() only ever sees history up to the current bar — future data is structurally out of reach. Fills happen at the next bar's open, so you can never trade a price the strategy couldn't have seen.
Taker fees on entry and exit, slippage, and per-bar funding charges — the cost that quietly eats perp strategies — plus liquidation checks. Profit factor and expectancy are computed after all of it, not before.
Every run exports a standalone HTML file: candles, trade markers, the equity curve, an underwater drawdown plot and play controls. You watch the strategy trade instead of trusting one summary number.
Install once, then sync the data, run a strategy, and open the interactive replay. Uses your CryptoDataAPI key in the CRYPTODATA_API_KEY env var.
sync caches klines + funding locally and extends incrementally from the last cached bar — no re-fetching what you already have. Any Hyperliquid or Binance symbol works. Need a key? Grab a free one or see the plans — bulk minute history is part of Pro Plus.
Pull 1-minute klines and funding for your symbol from CryptoDataAPI and cache them locally, resampled to your timeframe.
Replay bar-by-bar. Your strategy sees only past bars; orders fill at the next open with fees, slippage, funding and liquidation applied.
Get profit factor, expectancy, Sharpe and max drawdown, then open the HTML replay to watch the equity curve and every trade.
Subclass Strategy and implement on_bar(). Class attributes automatically become CLI-tunable parameters — sweep them without editing code. Built-in indicators cover SMA, EMA, RSI, ATR and Bollinger Bands.
Three strategies ship with the repo, run on the same 71-day BTC window. They're here to show how much results vary — and how easy it is to fool yourself.
| Example strategy | Win rate | Net return | Note |
|---|---|---|---|
| RSI Reversion | 62.5% | +2.09% | Modest edge survives fees on this window |
| Bollinger Revert | 64.2% | +1.64% | Works — but 79% of gross profit is eaten by fees |
| SMA Cross | 22.1% | −17.45% | Kept on purpose as an overfitting example |
The teaching moment: the sma_cross example was tuned on 70% of the data and looked fine — then lost 3.43% on the unseen 30%. That's why the engine makes honest costs and out-of-sample testing the default, not an afterthought. Backtests are historical simulations, not predictions — profitable history never guarantees live profit. This is educational software, not investment advice.
The backtester is only as honest as the data underneath it. It sources every bar from CryptoDataAPI so fees, funding and prices reflect what actually happened on-venue.
1-minute OHLCV plus funding-rate history for any Hyperliquid perp or Binance market — resampled locally to your chosen timeframe.
Local cache extends from the last stored bar instead of re-downloading, so repeated backtests stay fast and cheap on your quota.
Bulk minute history and deep klines/funding come from the backtesting archive — clean Parquet, updated nightly, part of Pro Plus.
See the full backtest data offering, the API docs (Backtesting section), or connect the MCP server so an agent can pull data and run the backtester for you.
The backtester is MIT-licensed and fully open-source. You only need a CryptoDataAPI key for the market data — the free tier covers live data, and bulk minute-history backtests use the Pro Plus archive.
Any Hyperliquid perpetual and 450+ Binance USDT markets. The sync command takes any symbol the CryptoDataAPI archive covers.
Yes — funding is charged per bar from real funding-rate history, and the engine runs a liquidation check each bar so an over-leveraged position gets closed the way it would on-venue.
Absolutely — point Claude Code, Cursor or any agent at the repo with the MCP server connected, and it can sync data, write a strategy and run the backtest end-to-end. See the prompt library for starting points.
Free, open-source, and honest about costs — with real Hyperliquid and Binance data behind every bar. Bring a CryptoDataAPI key and you're backtesting in minutes.
View on GitHub Need the data? Backtest data → · Compare plans →