Audits › Controls
The checklist
21 risk controls every trading bot needs
Not strategies. Controls: the code that decides whether a bug, a lost connection, a poisoned headline or an exhausted model quota costs you a little or costs you the account. Six groups; each control comes from a documented failure.
Size and exposure
- Maximum order size — Is there a hard cap per order, and in which unit is it validated: quote currency, base asset, or percent of balance?
- Execution paths that skip the cap — Do all order-sending paths go through the same risk check, or are there shortcuts such as rebalance, emergency close, batch or a newer strategy that bypass it?
- Total exposure and leverage — Besides the per-order cap, is there a limit on total exposure: the sum of open positions, the number of positions, or the maximum leverage?
Brakes and stops
- Global circuit breaker — Is there a kill switch that stops the whole bot after a daily loss, a drawdown, or a number of consecutive failures?
- Orphaned stop-loss — If the bot restarts or loses its connection, do open positions keep a stop order at the exchange, or does the stop only exist in the bot's memory?
- Orderly shutdown — When told to stop (signal, Ctrl+C, command), does it cancel open orders and record the open positions, or does it just exit?
Connection and operation
- Websocket and data reconnection — Does it reconnect on its own when the websocket or API drops, with bounded retries and without duplicating subscriptions? Does it back off on rate limits (HTTP 429)?
- Duplicate-process lock — Does it prevent two instances from running at the same time, with a lockfile, a PID file, or a semaphore?
- Heartbeat and alerts — Does it notify the user (Telegram, email, webhook) when it fails, stops or loses its data feed, and does it expose a heartbeat or health status that can be watched from outside?
Accounting and reconciliation
- Position reconciliation with the exchange — At startup and periodically, does it compare its own positions with the exchange's and resolve the differences?
- Fees and funding in the accounting — Does it subtract maker and taker fees and, on perpetuals, funding payments when computing profit and position size?
- Order rejection handling — What happens when the exchange rejects an order or fills it partially: bounded retry, log entry, alert, or silent loop?
- Auditable log — Does it keep a persistent record of every decision and order: time, reason, size, and the exchange's response?
Security
- API key permissions — Do the docs ask for an API key without withdrawal rights and with IP restriction, does the code work with such a key, and does the code ever call withdrawal or transfer endpoints?
- Secrets handling — Do API keys come from environment variables or a secret store, never from the code or versioned files, and do they stay out of the logs?
- Authenticated remote control — If it is controlled through Telegram, Discord or a web UI, does it obey only authorised users (id allow-list, token, password), or anyone who finds the bot?
AI and learning
- The model cannot override the brakes — If an AI model makes the trading decision, does that decision still pass through the deterministic controls (cap, breaker, exposure), or can the model set the size and skip the limits?
- Model output validation — Does it validate the model's answer (format, existing symbol, side, quantity, price within range) before turning it into an order, and reject malformed or invented answers?
- Learns from its mistakes — Does it record the outcome of each decision and use it to correct itself (parameter tuning, trade memory, prompt or strategy changes)? If it self-corrects, does the change go through a review, a backtest or a limit before trading with it?
- Model poisoning — If it feeds news, tweets or third-party messages into the model, are they treated as data (isolated, limited, with no power to order), or can an external text dictate a trade?
- Behavior without model quota or response — If the model does not answer, runs out of quota, or returns garbage, does the bot stop, hold its positions, or keep trading blind? Is there a daily cap on token cost?