Backtesting
Replay historical data, understand simulated execution, and compare strategy behavior reproducibly.
A backtest runs strategy code against historical observations using simulated execution. Use it to explain how inputs become signals, requests, and outcomes, and to compare revisions under recorded assumptions.
These guides follow the standalone SJS crossover. Start with its deterministic signal and one instrument, then vary one setting at a time.
Choose your workflow
| Workflow | What it provides |
|---|---|
| App-editor historical test | A quick check of the app's source and selected data, with chart, trades, and log access |
| Agent Lab historical run | A run attached to a source revision, saved result artifacts, and reusable experiment data |
| Running simulated session | Ongoing incoming data with simulated execution; different from replaying a fixed historical window |
Agent Lab currently uses the generic memory runtime for supported bar-based experiments. It does not reproduce every broker-specific app runtime. Other app-editor workflows, such as Polymarket simulation, have their own execution behavior.
Follow the decision to its outcome
Source revision + data selection + execution settings
↓
Historical observations
↓
Warmup and strategy decisions
↓
Requests and simulated fills
↓
Results, logs, and comparisonAn observation can produce no decision; a decision can produce no request; an accepted request can remain pending. Keep those stages separate when investigating a result.
Read in order
- Getting started: run the SJS example and establish a baseline.
- Market data: inspect selection, coverage, and the frames your script receives.
- Execution and fills: understand price checks, delay, and run-end closing.
- Warmup: supply enough history without assuming live warmup behavior.
- Reading results: interpret trade records, logs, and metrics.
- Comparing runs: distinguish source changes from data and execution changes.
- Debugging: locate the first unexpected stage.
- Limitations: understand what the simulation does and does not model.