Backtesting
Run your WASM algo against recorded market data using the sim engine.
sequence backtest BTC-USD --start 2026-01-01 --end 2026-01-31Usage
sequence backtest <SYMBOL> --start <DATE> --end <DATE> [OPTIONS]Required
| Argument | Description |
|---|---|
<SYMBOL> | Trading pair (e.g., BTC-USD) |
--start <DATE> | Start date (YYYY-MM-DD) |
--end <DATE> | End date (YYYY-MM-DD) |
Options
| Flag | Default | Description |
|---|---|---|
--symbols <LIST> | - | Multiple pairs, comma-separated (overrides positional SYMBOL) |
--capital <USD> | 100000 | Initial capital in USD |
--venue <LIST> | all | Limit to specific venue(s), comma-separated |
--seed <INT> | 42 | PRNG seed for deterministic replay |
--skip-build | false | Use existing .wasm (skip cargo build) |
--bundle <ID> | - | Use a registered bundle instead of building from source |
Examples
Single Symbol
sequence backtest BTC-USD \
--start 2026-02-01 \
--end 2026-02-28 \
--capital 50000Multi-Symbol
sequence backtest --symbols BTC-USD,ETH-USD,SOL-USD \
--start 2026-01-01 \
--end 2026-03-01 \
--capital 100000Specific Venues
sequence backtest BTC-USD \
--start 2026-02-01 \
--end 2026-02-28 \
--venue kraken,coinbaseFrom a Bundle
sequence backtest BTC-USD \
--start 2026-02-01 \
--end 2026-02-28 \
--bundle bun_e4f2a1This reads bun_e4f2a1.bundle.json for the WASM reference instead of building from source.
Deterministic Replay
sequence backtest BTC-USD \
--start 2026-02-01 \
--end 2026-02-28 \
--seed 123Same seed + same data = identical results. Useful for A/B testing strategy changes.
How It Works
Resolve WASM
From --bundle manifest, or build from source, or use existing .wasm with --skip-build.
Launch sim-engine
The CLI shells out to sim-engine run with your parameters. The sim engine replays recorded L2 events and trades from Parquet files.
Execute your algo
Your WASM algo receives book updates and produces actions exactly as it would in live trading. All time is simulated - no SystemTime::now() in the sim loop.
View results
Simulation output streams to stdout: fills, P&L, and summary statistics.
The sim engine must be installed and in your PATH. sequence update installs it alongside the CLI. You can also build it with cargo build -p sim-engine --release.
Data Requirements
Backtests read from the sim data store:
- Local:
./data/sim/(default). SetSIM_STORE_PATHto override the local directory. - S3: Remote object store (set
SIM_STORE=s3). SetSIM_S3_BUCKETfor the bucket name (default:sequence-sim-data-dev).
| Variable | Default | Description |
|---|---|---|
SIM_STORE | local | Storage backend: local or s3 |
SIM_STORE_PATH | ./data/sim | Local filesystem path for sim data |
SIM_S3_BUCKET | sequence-sim-data-dev | S3 bucket name when SIM_STORE=s3 |
Dashboard Backtesting
Backtests can also be launched from the Terminal dashboard. Open any deployment, navigate to the Backtest tab, and configure date range, capital, and seed. The dashboard uses the POST /v1/backtest API and displays results inline -- including equity curves, summary metrics, and decision traces.
See the Backtest API for the underlying endpoints.
Advanced Features
The sim engine includes realism models (adverse selection, self-impact, volatility-conditioned latency), calibration tools, and stress testing scenarios.
See the full Sim Engine reference for details.