Engineering · TRUEFIX LABS
Preventing Duplicate Orders in Automated Trading Systems
Client order IDs, idempotency keys, retries, timeouts, unknown execution states, and reconciliation for safe order submission.
Short answer. Prevent duplicate orders by assigning a deterministic client order identity before submission, persisting the request, using provider-supported idempotency where available, and reconciling ambiguous results before retrying. A timeout is a state transition to investigate, not permission to send the same order again.
Identity model
Derive a stable request identity from strategy revision, account, environment, instrument, intent revision, and a unique command sequence. Persist the identity before the network call and retain the provider-native ID once known.
Safe retry matrix
| Operation | Retry guidance |
|---|---|
| Read snapshot | Bounded retry with backoff |
| Order submission | Reconcile first; resend only with proven idempotency |
| Cancel | Query current order state, then issue a new command if needed |
| Replace | Track the original and replacement as related revisions |
Network ambiguity
The provider may have accepted an order even when the client received no response. Persist Unknown, search by client order ID or native ID, and use account or time-window reconciliation as a fallback.
Audit requirements
Record request hash, idempotency key, attempt number, policy version, operator approval, response, retry reason, and reconciliation outcome.
Sources
Last verified: 2026-09-28. Provider capabilities can change by region, account, product, environment, and entitlement; verify the linked official documentation before production use.
Last updated: 2026-09-28