A live dashboard cannot make an unattended trading agent safe.
Monitor decisions and state, not just process health
A process can be healthy while its trading is not. A green heartbeat only says that some component is responding. It does not prove that prices are current, positions reconcile with the broker, cancellations took effect, or the agent is respecting its mandate.
Build monitoring around three separate questions: is the system operating, is its trading state correct, and is its behaviour within authorised bounds? Keep these signals distinct. A successful API response is not proof of a filled order, and a running strategy is not proof that it has valid market data.
For every decision and order, record a timestamp, strategy and version identifier, account, instrument, input data timestamp, intended action, limit checks and broker response. Use UTC timestamps and retain both the event time and the time your system received the event. That difference helps expose delayed feeds and delayed callbacks.
The ranges below are typical operational starting points, not universal limits. Venue, asset class, API design and strategy cadence change what is reasonable. Measure the distribution in your own system before setting alert thresholds.
| Signal | Typical range | What to check |
|---|---|---|
| Agent heartbeat | 1 to 5 seconds | Alert after 2 to 3 missed intervals, with a separate check for strategy progress. |
| Market data staleness | 1 to 10 seconds | Use instrument-specific limits; a fast strategy may need a much tighter bound. |
| Order acknowledgement | 100 ms to 2 seconds | Track percentiles by broker route, not only a single average. |
| Position reconciliation | Every 1 to 5 minutes | Compare internal positions and open orders with broker state; reconcile immediately after reconnects. |
| Alert delivery | 5 to 60 seconds | Measure from trigger to receipt, and test the backup route separately. |
Reconcile orders before trusting exposure
Exposure calculations built only from the agent's local order state can be wrong after a timeout, reconnect or partial fill. Treat the broker as an independent source of truth, while keeping enough local event history to explain differences. Polling too often can hit API rate limits; polling too slowly leaves a longer period in which the agent may act on stale exposure. Use streaming updates where available, then reconcile on a schedule and after any connection recovery.
Model an order as a state machine rather than a boolean. Submitted, acknowledged, partially filled, cancelled, rejected and expired are different states with different effects on risk. A cancel request is not a cancellation. Until the broker confirms the final state, reserve the remaining quantity against exposure. If the request times out, query by client order ID before retrying, so a retry does not create a duplicate order.
Reconciliation should compare at least position quantity, average price, open-order quantity and account equity or buying power where the broker exposes it. Define tolerances by instrument and contract size.
A one-share discrepancy may be material in a small account; a fractional difference in a large futures contract may require immediate investigation. Do not silently overwrite one ledger with another. Record the mismatch, freeze new risk if it crosses the configured tolerance, and make resolution auditable.
Keep a separate exposure view for proposed orders. Calculate the worst plausible position if all live orders fill, including partially filled orders and orders awaiting cancellation.
Apply limits to that scenario, not just the current filled position. This reduces the chance that several individually acceptable orders create an excessive combined position.
Make limits enforceable and fail closed
Risk controls should run outside the strategy process. If the strategy can modify its own limits or bypass the component that checks them, a software fault can disable both trading and its guardrails. Put order validation at the execution boundary, and make the broker adapter reject an order if the risk service is unavailable or returns an unknown result.
Useful controls include maximum order notional, maximum position, daily loss, order rate, price collars, permitted instruments and permitted trading hours. Set limits at account and strategy level. A shared account limit protects the account when two agents each remain within their own allocation. Apply a short-lived reservation when an order passes checks, then replace that reservation with confirmed fills or release it after a confirmed cancellation or rejection.
Choose explicit behaviour for each failure. A stale quote can block new orders while leaving existing protective orders untouched.
A breached daily loss limit can cancel resting entry orders and disable new entries. A position mismatch may block the affected instrument but allow unrelated strategies to continue, if the account-level exposure remains known. A broken account-wide reconciliation should generally stop new risk across the account.
- Use a hard kill switch that blocks new submissions at the execution gateway, not only a strategy flag.
- Define whether the switch cancels open orders, and verify the broker confirms each cancellation.
- Make limit changes versioned, permission-controlled and recorded with an actor and reason.
- Require a deliberate recovery check before trading resumes after a risk stop.
- Test rate-limit responses, partial outages and duplicate callbacks without assuming they are rare.
There is a trade-off between availability and safety. Failing closed can miss a valid trade during a brief risk-service outage.
Failing open can place an order without a current limit check. For an unattended system, make that decision explicit for each control, document its maximum exposure during failure, and avoid a blanket fallback that permits all orders.
Keep compliance evidence tied to each order
A useful audit trail answers what the agent knew, what it decided, which rules it evaluated and what the broker did. Store immutable or append-only events for market inputs, model or strategy version, configuration, risk results, order requests, broker acknowledgements, fills, cancels and operator interventions. Include request IDs and client order IDs so retries and broker events can be joined without relying on approximate timestamps.
Access controls matter as much as retention. Separate permission to deploy code, change risk limits and stop trading. Record who made each change, when it took effect and which process accepted it. Set retention based on the applicable regulatory and broker requirements for the instruments and jurisdictions involved; do not assume one period fits every account. Protect credentials and personal data, and restrict log access to the people and services that need it.
Alerts should point to evidence and a defined response, not just announce a number. Route critical events such as a hard-limit breach, unexplained position mismatch or repeated order rejection to a monitored channel with a second route if delivery fails.
Lower-severity events, such as rising acknowledgement latency, can go to an operational queue if they have an owner and escalation deadline. A notification that no one receives is not a control.
Test the whole path in a controlled setting, including whether a human can identify the affected account and stop further submissions. Agentic paper trading, such as the environment at FX-Tech.ai, can help exercise order and monitoring logic without putting live capital at risk. Paper results do not establish how a live broker will handle outages, fills or compliance obligations, so retain those limits in the test record.
Prove the stop and recovery paths
Monitoring is useful only if it triggers a safe, understood response. Run fault drills before increasing live size.
Simulate a dropped market-data feed, a broker timeout after submission, a delayed fill event, a duplicate callback, a risk-service outage and an alert delivery failure. Measure the time from fault to detection, from detection to blocked orders, and from recovery to a verified account state.
Set thresholds from observed behaviour and the harm a delay can cause. A one-second alert may be appropriate for a fast order loop but create noise for a slow strategy. Repeated low-value alerts encourage operators to ignore the channel. Group related events, apply a cooldown where safe, and never suppress a fresh hard-limit breach merely because an earlier alert remains open.
After a stop, do not restart by resetting counters. Reconcile broker positions and open orders, confirm data freshness, check the active configuration and identify the failure cause. Require an explicit recovery action, preferably with a separate permission from deployment or limit editing. Keep a record of the evidence used to resume and the person or process that authorised it.
Stop doing the following:
- Stop treating a heartbeat or green dashboard as proof that trading is safe.
- Stop counting a cancel request as a completed cancellation.
- Stop retrying timed-out order submissions without checking broker state.
- Stop resuming after a risk stop by clearing the alert and restarting the agent.
Frequently Asked Questions
What should I monitor in an unattended trading agent?
Monitor process health, market-data freshness, order states, broker positions, exposure limits and alert delivery. Keep decision inputs and control actions in an auditable event trail so that a breach can be reconstructed.
How often should a trading agent reconcile with its broker?
A typical starting range is every 1 to 5 minutes, with immediate reconciliation after reconnects or ambiguous order outcomes. Adjust the interval to the broker's rate limits, strategy speed and cost of acting on stale state.
What should a trading kill switch do?
It should block new submissions at the execution boundary and follow a documented policy for cancelling open orders. Confirm broker-side cancellation, reconcile positions and require a deliberate recovery check before trading resumes.