9. Trade on Binance Demo¶
Binance Spot Demo Mode is a Binance environment with demo balances and its own API keys. The commands on this page are in scripts/docs/tutorial.sh --through demo.
1. Dry run¶
--dry-run connects to public market data only, reads no keys and sends no orders. first_mm logs started, quoting on and quotes as it will with keys; the orders stay on paper, and every 5 s a dry run BTCUSDT: bid ... ask ... line shows what would rest. The status line shows md=live and books=1/1. Exit messages: Troubleshooting.
2. Keys¶
Switch to Demo Trading on binance.com, create an API key under API Key Management, and export it in the terminal that runs the session:
Binance testnet keys do not work here (Binance Spot Demo Mode). The configuration reads the variables as api_key = "${FASTMM_BINANCE_API_KEY}" (Configuration).
3. The risk limits¶
The strategy quotes 0.0001 BTC (about 8 USDT) per side and stops adding at 0.0003 BTC. Independently of the strategy, the engine's pre-trade checks in configs/tutorial-binance-demo.toml refuse anything beyond these limits:
[risk] key |
Value | Effect |
|---|---|---|
max_order_qty |
0.0002 |
no order above 0.0002 BTC |
max_order_notional |
25 |
no order above 25 USDT |
max_position |
0.0004 |
position plus same-side open orders stays within 0.0004 BTC |
max_open_orders |
2 |
at most 2 open orders |
max_loss |
5 |
the kill switch trips when net PnL reaches -5 USDT (After a kill) |
orders_per_sec, burst |
2, 4 |
orders per second, burst |
The Demo account charges 10 bps per fill; first_mm quotes 5 bps from the microprice.
4. A five-minute session¶
Warning. This command places orders with the keys you exported. Use Demo Trading keys, not the keys of a real account (Kill switch and shutdown).
"$BIN"/tutorial-live --config configs/tutorial-binance-demo.toml --duration 5m \
--journal runs/tutorial/demo.fmj --log runs/tutorial/demo.log
Watch it from a second terminal:
Within a few seconds the status line shows md=live user=live order=live and fastmm-top shows two open orders. Stop the session with Ctrl-C before the five minutes are up.
5. Check the shutdown¶
The log ends with:
Ctrl-C tripped the kill switch. cancel_all ok means the venue's cancel-all request succeeded; confirm in the Demo Trading web interface that no order is open (Go-live checklist). If the line says cancel_all FAILED, cancel by hand and follow When cancel_all failed; the next session also cancels, when it connects, the orders an earlier one left open.
6. Check the PnL¶
The report lists fills, maker share, volume, fees and inventory, and compares the journal's PnL with the engine's final summary; they agree to within rounding. To reconcile against the account's balances, take balance snapshots before and after the session (Journals, replay and PnL).
Next: Go-live checklist before a longer session; Run on a testnet or Binance Demo for the other practice environments (Binance USDⓈ-M Demo Trading, the Binance Spot testnet, Bybit and Deribit).