Agentic Trading Index

Trading agent monitoring for unattended execution

Trading dashboard displaying execution and position monitoring for an unattended trading agent
Photo by Aedrian Salazar on Pexels

A 0.8% adverse move on a £50,000 account costs £400 before fees. If an unattended agent takes 40 minutes to notice, monitoring has failed at the point it matters. A useful monitoring system must detect not only whether the programme is running, but whether its market data, orders and broker-side positions still agree.

Consider a hypothetical intraday agent trading a liquid currency pair, with £50,000 allocated capital and a 0.25% risk limit per trade. It normally submits four to eight orders an hour during its active session. The figures below are an operating example, not a performance claim. The practical question is what the system should observe, and what it should do when an observation looks wrong.

Monitor the chain, not just the process

A process heartbeat proves that a process can send a heartbeat. It does not prove that the agent has a fresh quote, that an order reached the broker, or that the broker accepted the resulting position. Track each step from input to account state, with timestamps and identifiers that let an operator reconstruct what happened.

Signal and data health

Record the exchange or provider timestamp, local receipt time, symbol, sequence number and bid-ask spread for every input used to form a decision. Measure quote age at decision time, not only when a feed message arrives. A connection can remain open while messages stop advancing. Clock skew matters too: a local clock that is several seconds ahead can make fresh data appear stale, or hide a delay in the event trail.

For each strategy, set a permitted data age based on its holding period and venue. A one-second threshold may suit a fast intraday signal; a slower strategy may tolerate several seconds. If a required input is stale, stop generating new orders. Do not silently substitute a last-known value unless the strategy was designed and tested for that condition.

Order and account health

Persist each decision before sending an order. Include a unique client order ID, strategy version, intended side, quantity and decision timestamp.

After submission, record the broker acknowledgement, broker order ID, status transitions, fills and fees. A timeout is an unknown outcome, not evidence that the order failed.

Reconcile local state against broker state on a schedule and after reconnects. Compare positions, open orders and recent executions. If an acknowledgement times out, query by client order ID before retrying. Retrying blindly can create a duplicate position. Keep a durable event log so a restart can rebuild state without relying on in-memory order objects.

Set thresholds that trigger a defined action

Alerts need a threshold, a severity and a response. The ranges in this table are typical starting points for liquid, electronically traded markets.

They are not audited results for a particular broker or platform. Tune them against the instrument, venue, strategy cadence and observed latency.

SignalTypical warning rangeTypical action rangePossible response
Quote age1-3 seconds5-15 secondsBlock new orders; cancel resting orders if the strategy requires current prices
Order acknowledgement1-3 seconds5-10 seconds without a known statusQuery by client order ID; do not resubmit until outcome is known
Position mismatchAny unexplained differenceDifference persists after a fresh broker queryDisable that instrument and reconcile fills
Heartbeat age5-15 seconds30-60 secondsPage an operator; block replacement workers until state is recovered
Order rate70-90% of configured capAt the capReject further submissions and inspect the event stream

Keep warnings separate from hard stops. A warning can go to a dashboard or low-priority notification.

A hard stop should change what the agent is allowed to do, even if nobody reads the alert immediately. Useful controls include:

  • A maximum order rate and maximum open-order count per strategy and account.
  • A gross and net exposure limit, plus a per-instrument position cap.
  • A maximum daily loss or drawdown that blocks new risk, with a separate policy for closing existing risk.
  • A kill switch that disables submissions and cancels orders where cancellation is safe and supported.

Alerts should carry the account, instrument, strategy version, last known position, order IDs and the action taken. A message saying "execution error" is not enough to diagnose an unattended system.

Walk through a failure before it happens

The first ten minutes

In the hypothetical example, the agent submits a 20,000-unit order. The network connection drops before the acknowledgement reaches the agent. Its local record says "pending"; the broker has accepted the order and filled 12,000 units.

A naive retry sends another 20,000 units. Monitoring that watches only process uptime sees a healthy service while exposure nearly doubles. The safer sequence is mechanical:

  1. Mark the first order as outcome unknown and prevent a retry.
  2. Query the broker using the client order ID and fetch executions since the last confirmed sequence number.
  3. Update the local ledger from broker fills, then compare the resulting position with the broker's current position.
  4. If the query cannot establish a consistent state within the configured recovery window, block new orders and alert with the unresolved IDs.

Suppose the broker query confirms a 12,000-unit fill and a 8,000-unit remainder still working. The agent can then decide whether to leave or cancel that remainder under its order policy. It must not treat a partial fill as either a complete failure or a complete fill. Record cancellation requests separately from cancellation confirmations; an order is not cancelled until the broker confirms it.

Recovery without hiding the incident

After connectivity returns, compare the broker's open orders and executions with the local event log before enabling submissions. Preserve the original timestamps and mark gaps explicitly. Do not rewrite the event history to make the restart look clean. Calculate exposure from confirmed fills, not from intended quantities or cached strategy state.

Use severity levels to prevent noisy alerts from obscuring a real fault. For example, a short quote delay may create a warning, while a position mismatch or unknown order outcome blocks new risk. Send critical alerts through at least two independent routes, such as an on-call paging service and a separate account notification. Test that route periodically; a notification that was configured but never delivered is not a control.

Make the response testable

Monitoring rules need tests that inject failures. Simulate delayed quotes, dropped acknowledgements, partial fills, duplicated events, process restarts and broker responses arriving out of order. Check both the alert and the resulting permissions: did the agent stop sending orders, preserve its event log and recover only after reconciliation?

Track a small operational scorecard each session:

  • Quote age at decision time, order acknowledgement latency and fill-to-ledger delay.
  • Counts of unknown order outcomes, rejected orders, duplicate client IDs and position mismatches.
  • Time from fault detection to blocked submissions, and time from reconnect to reconciled state.
  • Exposure and realised loss at the moment each control activated.

Keep thresholds in configuration with a version and change record. Review them after changes to the strategy, broker adapter, venue or data provider. A threshold copied from a liquid currency pair may be unsuitable for a less liquid instrument. Test alert delivery and recovery in a controlled environment before live use. An agentic paper-trading environment can help exercise order-state and restart handling without exposing live capital, but it cannot reproduce every production failure.

Most readers will still make the same mistake: treating a green heartbeat as proof that the agent is safe to trade.

Frequently Asked Questions

What should trading agent monitoring track?

Track data freshness, order acknowledgements and status changes, broker fills, positions, exposure, loss limits and process health. Preserve timestamps and IDs so each decision and order can be reconciled after a fault.

What should an agent do after an order API timeout?

Treat the outcome as unknown and do not blindly resubmit. Query the broker using the original client order ID, reconcile fills and open orders, then allow new submissions only when local and broker state agree.

How often should an unattended trading agent reconcile positions?

A typical design checks after reconnects and order events, with periodic reconciliation during trading as a backstop. The interval depends on strategy speed and broker limits; any unexplained mismatch should block new risk until resolved.