Go-live checklist¶
Work through this list before the first live session, and again whenever the binary, the config or the strategy parameters change. Background: Run in production; the economics of the shipped strategies: Economics.
The build and the strategy¶
- The release build passes its tests:
ctest --preset release. - A backtest with your
[strategy.params]gives results you accept, for example./build/release/bin/fastmm-backtest --config configs/backtest-example.toml --data synthetic. - The strategy survives the simulated exchange with faults (fault injection):
- Enable
[sim.faults]in a copy ofconfigs/sim.toml. - Run
./scripts/run-sim.sh --duration 5m --sim-config <your sim config>. - Each ERROR line in the engine log follows from an injected fault, and the shutdown line says
cancel_all ok.
- Enable
- A restart restores the position:
kill -9a keyed session that holds a position and start it again. It logsrestored position, ends at the venue's position, and leaves none of the dead process's orders (Restarts). -
The strategy is deterministic. Record a backtest, then replay it;
--verifyexits 0: -
A live session replays. Take the journal the simulator run logs as
journal: <path>, run./build/release/bin/fastmm-replay --journal <path> --verify, and seereplay MATCHwith exit code 0 (Replay). Do the same for the practice session below.
A practice session¶
- A Binance Demo or testnet session of at least 24 h with the same strategy and risk settings (Run on a testnet).
- Each ERROR line has a known cause:
grep ' ERROR ' runs/demo-1/engine.log(Troubleshooting). - The session's PnL reconciles with the account (Check PnL).
- Your PnL estimate includes fees (example).
Risk limits¶
A [risk] limit is off when it is 0 or missing (Configuration). A session with keys does not start without max_loss and one of max_position or max_order_notional.
| Set | Note |
|---|---|
max_order_qty, max_order_notional |
in the settlement currency: the base coin for an inverse contract |
max_position |
per instrument; counts same-side open orders |
max_open_orders |
per instrument |
price_collar_bps, fat_finger_bps |
refuse prices too far from the mid and from the last trade |
stale_md_ms |
refuse orders while the book is older than this |
max_gross_notional, max_net_notional |
across instruments |
max_loss |
what you accept losing. The budget carries across restarts until --clear-kill (The latched loss budget) |
[engine] on_kill |
what the process does when a limit trips (After a kill) |
[accounting] |
with more than one settlement currency: the reporting currency and a rate source per other currency. Without it, a start with max_loss exits 3 (Configuration) |
orders_per_sec, burst |
below your account's order rate limit at the venue. Connectors also limit themselves: Bybit orders_per_second, Deribit matching_engine_rate and matching_engine_burst, Binance from the account's own order limits |
stp = true |
unless you trade against yourself on purpose |
Keys and access¶
- Keys come only from the environment (Configuration); never run with
--allow-inline-secrets. - The key can trade and nothing else: no withdrawals, no transfers.
- The account or subaccount is the session's alone. The session cancels unknown open orders on its symbols, and its cancel-alls take every order there (
cancel_unknown). - The key is restricted to your server's IP addresses where the venue supports it.
- Each running engine has its own key, so revoking one stops one engine.
The host¶
-
Threads and spin mode match the machine (Cores), and the
topology:lines at start show no warning:Host [engine]bare metal cpuandnet_cpuson isolated cores,spin_mode = "busy"shared machine spin_mode = "adaptive"WSL2, laptop spin_mode = "adaptive",cpu = -1fastmm init --profile productionwrites a Binance Spot config for a dedicated host.configs/profiles/production-latency.tomlhas the same[engine]table: busy spinning on isolated cores,timer_slack_ns = 1,lock_memory = trueand a larger journal ring.lock_memoryneeds a raisedulimit -l, orLimitMEMLOCK=infinityunder systemd. -
The engine and network cores are isolated with
isolcpus,nohz_fullandrcu_nocbs, or a cpuset. - The CPU governor is
performance, and NIC interrupts go to other cores. - Transparent huge pages are
madviseoralwaysin/sys/kernel/mm/transparent_hugepage/enabled: the order and book tables ask for 2 MiB pages. - Latency figures in
fastmm-topand the log are not zero. Hosts withoutnonstop_tsc, such as many cloud VMs, take wall time fromclock_gettimeand still time intervals with the TSC whenconstant_tscis present. - The system clock is synchronised by chrony or systemd-timesyncd, and the status line's
clock_offset_msstays well belowrecv_window_ms. - The journal directory has room for the session:
df -h runs(Journal files). -
./build/release/bin/fastmm-top --name <engine name> --onceprints a frame while the engine runs. - The log goes to a file (
--log), and warnings are mirrored to stderr by[logging] mirror_level.
Stopping¶
- You have done a kill-switch drill with this config: a keyed session with open orders, Ctrl-C, the line
shutdown took <n> ms (cancel_all ok)(Reading the last lines), and no open orders left at the venue. - After every stop, the venue's open-orders page shows no orders, even after
cancel_all ok. The shutdown sends one cancel-all per subscribed instrument;okdoes not cover other instruments, orders accepted after the request, or a--dry-run, which skips it. - You know where the venue's own "cancel all" is on its website, and you have read When cancel_all failed.
-
[engine] on_killis set, and whatever startsfastmm-liveorpython -m fastmm runalerts on exit codes 5, 6 and 7. The shipped systemd unit does not restart them (Deploy). - Someone watches the first live session from start to finish.