Backtest vs Live Replay
Replay runs the backtest engine over the same window your live bot traded, then produces a trade-by-trade diff. Answers the "backtest and live look like two different strategies" question without needing an engineer to walk through your data.
When to use this
Use Replay when you're asking any of these questions:
- "Is my live bot firing the same signals the backtest said it would?"
- "Why does my live PnL disagree with my backtest?"
- "Did something change in my strategy? Why are positions different now?"
- "My bot missed a trade I saw in backtest. What happened?"
If your bot is running normally and the backtest matches live, you don't need Replay.
How to run it
- Navigate to
/dashboard/trading-bots/<botId>/replay(from your bot's dashboard page, replace the URL path). - Pick a window: Last 24h, Last 7 days, or Last 30 days.
- Click Run replay.
First replay for a given window takes 10-30 seconds while candles are fetched from the exchange. Subsequent replays on the same window are near-instant (candles are cached for 24h).
What Replay covers
Replay only runs against strategy bots. Webhook bots, signal bots, and manual bots don't have a programmatic strategy to compare against, so they can't be replayed.
Replay uses:
- The same strategy version your live bot is running (resolved via your bot's version channel or pinned version)
- The same exchange, symbol, and timeframe as your live bot
- The same parameter overrides, MTF config, and leverage
- The same time window as the live trades you're comparing
Reading the result
Summary cards (top of page)
| Card | What it means |
|---|---|
| Live trades | How many round-trips your bot executed in the window |
| Backtest trades | How many round-trips the backtest produced over the same candles |
| Match rate | % of trades that paired up between live and backtest (ideally 100%) |
| Mean entry-time delta | Average timestamp difference for paired trades (should be ≤1 bar) |
Match rate 100% + mean delta ≤1 bar means your strategy is behaving identically in live and backtest. Any PnL drift after that is fee or slippage, not a strategy bug.
Matched trades table
Trades that paired between live and backtest. Per-field deltas:
- Δ time — entry-time difference in seconds (live − backtest; positive = live fired later)
- Δ entry px — entry price difference as %
- Δ size — position size difference as %
- Δ pnl — PnL difference in quote currency
Small deltas are expected. Large deltas (>0.5% price, >5% size) point to slippage or fee-model differences.
Live-only trades
Trades your bot fired that the backtest didn't produce. Common causes:
- Live state drift — indicator computed over a forming candle the backtest wouldn't see. (Fixed in v0.3.12.0 for
on_bar_closebots.) - DCA partial closes — each close leg shows as a separate live trade. Replay now merges legs sharing a
positionGroupIdinto one row; orphan legs here indicate a grouping issue on the bot's part. - Fee/slippage model drift — the backtest uses default fees (0.1%) and slippage (0.05%); your live exchange may charge less (maker rebate) or more. PnL differs even when signals match.
Cross-reference the entry timestamps against your exchange fill history before concluding it's a bug.
Backtest-only trades
Signals the backtest expected but your live bot didn't fire. Common causes:
- Bot was paused or throttled at the moment
- Exchange returned a rate-limit error on the entry
- Semaphore exhaustion (other bots on the same exchange consumed the concurrency budget)
Check the bot's Activity tab for those timestamps.
Warnings banner
Replay surfaces caveats the diff's accuracy depends on. Read these before interpreting:
- Hardcoded fees (always) — backtest uses 0.1%/0.05% flat; PnL deltas include fee-model drift. Focus on entry timestamps and prices first, treat PnL delta as noisy.
- Bot config modified in window — if you edited the bot mid-window, live trades reflect two configs; backtest only uses the current one. Narrow the window.
- Strategy version updated in window — if the strategy author published a new version mid-window, live trades ran the old version; backtest runs the new. Narrow the window to after the update.
- DCA bot detected — partial-close legs have been merged for a readable diff; the backtest similarly emits one row per position.
Limits
- Window capped at 30 days.
- Candle count capped at 1000. A 30-day window on 1m timeframe is 43,200 candles — that's rejected with HTTP 413 and a recommendation to use a coarser timeframe. Replay is sync-in-process; the cap keeps one replay from tying up the server for 2+ minutes.
- Strategy bots only. Webhook + manual bots don't apply.
- Single-exchange bots only. Multi-exchange bots are rejected; support is a planned follow-up.
- Rate-limited to 10 replays per minute per IP.
What Replay doesn't do
- It does not run a new backtest you can save. Nothing is persisted. Each replay is a one-off comparison.
- It does not consume your monthly backtest quota. Replay is diagnostic, not production backtesting.
- It does not detect strategy-code changes from git history. If you compiled the strategy differently between two deploys, Replay can't see that — narrow the window to after the deploy.
Troubleshooting
"No trades in the window" — either your bot didn't signal, or the window is too short. Try a longer window.
"This window is too large to replay synchronously" — you've hit the 1000-candle cap. Use a coarser timeframe, a shorter window, or wait for async replay (planned follow-up).
"Strategy version could not be resolved" — the bot's version pointer is broken. The backtest fell back to the engine's default version selection; the diff may not reflect the actual live version. Fix the bot's version pin on the Edit Bot page first.
Match rate is 0% — something is structurally wrong. Most likely the bot's exchange changed, or the strategy code diverges from what ran in live. File a support ticket with the replay output attached.