Agentic Trading Index

Position reconciliation is a risk control for trading agents

Trading terminal showing positions and broker order data for position reconciliation
Photo by Rafael Minguet Delgado on Pexels

A broker position is not always the source of truth. A position snapshot can be delayed, netted, incomplete or temporarily out of step with executions already received by the agent. For unattended trading, the safe approach is to compare independent records, account for pending events and stop risk-increasing activity when the difference cannot be explained.

A mismatch is not just a data-quality problem. If the agent believes it is flat while the broker holds a long position, it may add exposure, misstate limits or send an unintended short sale.

If it believes a fill did not happen, a retry can create a duplicate order. Position reconciliation is therefore part of the risk and compliance control system, not a dashboard check.

Define what counts as a position

Do not compare a strategy's target position directly with a broker's current position. A target is an instruction.

A submitted order is not a fill. The agent's expected position should be built from an opening position, confirmed executions and recognised adjustments:

Expected position = opening position + signed executions + approved adjustments.

For each instrument, define the account, broker instrument identifier, currency, quantity scale and whether the broker reports net or gross exposure. Include the contract multiplier for derivatives. A futures position of two contracts and an equity position of 200 shares are not comparable quantities, even if their notional exposure is similar.

Maintain separate records for confirmed executions, working orders and the resulting position. A partially filled order changes the position only by its filled quantity.

A cancel request does not remove the unfilled quantity from risk calculations until cancellation is confirmed. Corrections, trade busts, allocations and corporate actions can also change the position after the original execution event.

  • Use stable broker instrument IDs where available. Do not rely on a ticker alone when venues, contract months or currency classes can differ.
  • Represent executions with signed quantity, execution ID, timestamp and correction status. Deduplicate on broker identifiers, not only on price and quantity.
  • Keep working-order exposure separate from filled exposure, then include both when checking order limits and available risk.

Netting needs explicit treatment. A broker may show one net position where the strategy maintains multiple sleeves or strategies. Reconcile at the account and instrument level first, then compare sleeve allocations only if the broker supplies allocation data or the agent can derive it from a complete execution ledger.

Reconcile events, snapshots and uncertainty

Use execution events for low-latency updates and periodic position snapshots as an independent check. Neither channel is complete on its own. Events can arrive late, out of order or more than once. A snapshot can arrive while an execution is still being processed. Record both the broker event time and the time the agent received it, and retain the raw response needed to explain a later difference.

A solid loop has four stages: ingest and deduplicate broker events; update expected positions; fetch or receive a broker snapshot; compare quantities after applying known pending events and adjustments. If a snapshot predates an execution, do not flag the difference as unexplained. If the event stream has a sequence gap, mark the account state as uncertain and request a fresh snapshot rather than assuming nothing happened.

Include open orders in the same risk view. A snapshot may show current holdings but say nothing about an order that is live at the venue or awaiting a cancel response.

Before retrying a timed-out submission, query by client order ID or broker order ID. A timeout means the outcome is unknown, not that the broker rejected the order.

Choose a short grace period for ordinary propagation delay, then distinguish a known delay from a genuine discrepancy. A grace period should not silently permit new exposure. The control should be able to pause risk-increasing orders while still allowing a verified reduce-only action where the broker supports it and the account state is sufficiently reliable.

Set thresholds by instrument and failure mode

Thresholds depend on the broker's update behaviour, instrument granularity and strategy speed. The figures below are typical operating ranges for engineering design, not audited results for any named platform. They are starting points to test against the actual API and trading session.

Control measureTypical rangeOperational useRisk caveat
Streaming event delay0.1 to 2 secondsAllow for ordinary delivery and processing latencyMeasure separately during opens, closes and reconnects
Position snapshot interval5 to 30 secondsCross-check the agent ledger against broker stateUse a faster interval for strategies with rapid turnover
Unexplained-difference grace period2 to 10 secondsWait for known in-flight events before escalationDo not treat the grace period as permission to increase exposure
Equity quantity tolerance0 shares after events settleRequire exact reconciliation at the instrument levelFractional-share accounts need the broker's supported precision
FX quantity tolerance0.01 to 0.1 lot during propagationSet a temporary alert threshold while events are pendingAfter settlement of events, reconcile to the broker's quantity precision
Futures quantity tolerance0 contracts after events settleCheck contract count and expiry separatelyA correct count on the wrong expiry is still a mismatch

A quantity tolerance is not a risk limit. A mismatch of one share may be immaterial for a large liquid position but still indicate a duplicated or missing execution.

Pair quantity checks with notional and portfolio exposure checks. For example, a fixed 0.1-lot FX tolerance has a different risk impact across currency pairs and account sizes.

Define what the agent does at each severity level. A useful policy distinguishes a transient, explainable delay from an unexplained mismatch, a stale connection and a repeated reconciliation failure. Record the policy in configuration, including who or what can release a trading pause.

  • For a short-lived difference with a known pending fill, hold new orders that could increase exposure and wait for the event or next snapshot.
  • For an unexplained difference beyond the grace period, stop risk-increasing orders, query order and execution history, and alert the operator or control service.
  • For a material exposure discrepancy, duplicate-order risk or missing event sequence, block the account until state is rebuilt and the release condition is met.
  • Do not automatically trade the difference unless the broker state, live orders and intended target have all been checked. An apparent correction can otherwise compound the original error.

Make every decision reviewable

Compliance review needs to establish what the system knew when it acted. Store the agent's expected position, broker snapshot, open orders, event sequence, comparison result and control decision with timestamps. Preserve identifiers and raw broker messages where policy permits. Record software and configuration versions so an investigator can reproduce the comparison logic used at the time.

Do not overwrite a mismatch when it clears. Keep the initial discrepancy, the events that explained it, any orders held or cancelled, and the time trading resumed.

This gives risk staff a way to distinguish harmless propagation delay from a recurring feed or order-management fault. Retention periods and access controls should follow the firm's applicable regulatory and recordkeeping obligations.

Test failure paths, not only clean fills. Simulate duplicate events, out-of-order executions, partial fills, rejected cancels, disconnects and broker snapshots that lag the event stream.

Check that a restart rebuilds positions without replaying an execution twice. An agentic paper-trading environment such as FX-Tech's paper trading, available from $9.99 a month, can support rehearsal of these workflows, but simulated broker behaviour cannot establish live API timing or reconciliation quality.

Before unattended deployment, define the mismatch threshold, the actions the system may take while uncertain, and the evidence needed to resume. The event-by-event controls above do not apply to a broker that exposes only end-of-day positions and no execution feed; that account needs a batch reconciliation process and must not be treated as continuously reconciled.

Frequently Asked Questions

What is position reconciliation in automated trading?

It is the comparison of an agent's expected holdings with broker-reported positions, using executions and recognised adjustments to explain the difference. The process should also account for working orders and events that have not yet arrived.

Should an agent use broker positions or its own execution ledger?

Use both. The agent ledger provides a timely expected position, while broker snapshots provide an independent check. A mismatch should be explained using executions, pending orders, corrections or adjustments rather than resolved by trusting one source blindly.

What should a trading agent do when positions do not match?

Pause orders that could increase exposure while it checks executions, open orders, sequence gaps and snapshot timestamps. Avoid sending an automatic corrective order until the broker state and any in-flight orders are understood.

How often should broker positions be reconciled?

For active intraday systems, a typical design uses streaming execution updates with snapshots every 5 to 30 seconds, adjusted for the broker API and strategy speed. Reconcile again after reconnects, restarts, trading-session transitions and any unexplained event gap.