Modes at a glance
| Mode | Purpose | Typical use |
|---|---|---|
paper | Simulation with live-like runtime flow | Validate logic against current market streams without real execution |
replay | Historical backtest flow | Deterministic strategy verification on a fixed time window |
live | Production execution | Real order/transaction execution after validation |
Runtime API
UseuseExecutionMode() to inspect the active mode:
isSimulationistruefor non-live modesrecordingis configured through CLI mode options forpaperandlive
CLI commands
qf paper <strategy>qf replay <strategy> --from <date> --to <date>qf live <strategy>
Paper mode
Usepaper when strategy logic is still evolving and you want real-time behavior without real capital impact.
Typical characteristics:
- live-like event flow
- simulated execution paths
- optional recording for diagnostics (
--recording)
Replay mode
Usereplay for deterministic backtesting over a fixed period.
Replay characteristics:
- uses historical storage streams
- aligns runtime time with replay scheduler
- allows reproducible validations when window and inputs are fixed
useTimestamp and replay-aware branching.
Live mode
Uselive only after paper + replay confidence gates pass.
Typical characteristics:
- production connectors and execution
- real risk and real fills
- optional recording for audit and analysis
Mode-aware branching patterns
useSimulator(simulated, real) picks simulated logic for any non-live run.
useReplay(backtest, real) picks backtest logic only in replay mode.
Recommended promotion flow
- Build logic in
papermode. - Validate deterministically in
replaymode on targeted windows. - Promote to
livewith explicit session ID and recording where needed. - Keep mode branching explicit and minimal to reduce divergence.
Common mistakes
- Using
Date.now()instead ofuseTimestampin replay-sensitive logic - Mixing live side effects into replay code paths
- Skipping paper/replay validation before live rollout
- Over-branching strategy flow by mode instead of branching only execution edges