FIX vs REST vs WebSockets: a practical order-flow playbook

Server racks representing the infrastructure behind FIX, REST and WebSocket order flow
Photo by panumas nikhomkhai on Pexels

FIX, REST and WebSockets are three ways a trading system can exchange order messages with a broker or venue.

They are not interchangeable transport choices. FIX defines a trading-oriented message model and session behaviour; REST defines request-response interactions over HTTP; WebSockets provide a persistent, full-duplex connection on which an application protocol can run. A fair choice depends on order semantics, recovery, operating model and latency budget, not a protocol label alone.

Start with the order lifecycle

Map the lifecycle before comparing interfaces: submit, acknowledge, amend, cancel, reject, partial fill, fill and reconciliation. Record which component is authoritative for each state. An HTTP success response, a FIX Execution Report and a WebSocket message can all mean different things unless the provider documents exactly when an order is accepted and how later state changes arrive.

For each hop, write down the expected behaviour when the connection breaks after the client sends a request but before it receives an acknowledgement. The order may have reached the broker even though the client saw a timeout. Retrying blindly can create a duplicate. This ambiguity is a business-level problem, not something TCP or a faster network removes.

FIX is often selected for broker, venue and liquidity-provider connectivity because its order messages and session sequencing are familiar in institutional workflows. REST is common for account operations, lower-frequency order entry and integrations where HTTP tooling simplifies delivery. WebSockets suit applications that need a persistent stream of order updates, or a provider API that accepts commands on the same connection. Many production stacks use all three.

Compare mechanics, not protocol names

A FIX connection is normally a sequenced session over TCP. Logon, heartbeats, TestRequest, sequence numbers and resend handling support session liveness and message recovery. The client and counterparty maintain sequence state, often alongside persistent message logs.

ResendRequest and gap-fill processing help restore the session after a disconnect, but they do not guarantee exactly-once business processing. The order-management layer still needs duplicate detection and reconciliation.

REST sends an individual HTTP request and receives a response. It is straightforward to route through gateways, apply authentication and inspect with standard tooling. But a successful HTTP response may only confirm that the API received a request. The order can still be pending, rejected later or partially filled.

Use a durable client order identifier, and confirm whether the server treats repeated submissions with that identifier as idempotent. Do not assume that it does.

WebSockets keep a TCP connection open and allow both sides to send messages. This can reduce repeated connection setup and deliver updates promptly.

The application still has to define message types, ordering, sequence numbers, heartbeats, authentication refresh and recovery. A WebSocket reconnect does not automatically replay missed fills. Check whether the API offers sequence-based replay, a snapshot endpoint or both.

In practice, separate the command path from the state-recovery path. Submit and amend through the interface whose semantics and service levels are documented.

Consume updates on the persistent stream if useful, then reconcile against an authoritative order or execution query after any gap. A useful architecture reference is the trading infrastructure coverage, but validate every interface against the specific counterparty contract.

Use latency ranges as a sizing tool

The figures below are typical market ranges, not audited results for a named provider. They assume a same-region client-to-API or client-to-adapter path, a healthy service and application-level acknowledgement. They exclude exchange matching time, internet routing and unusually busy periods. Provider architecture and client code can move results outside these bands.

Order pathTypical acknowledgement p50Typical acknowledgement p99Typical recovery work after a gap
FIX over a persistent session1-5 ms5-25 msReplay or reconciliation, usually seconds for a small gap
REST over HTTP5-30 ms20-100 msRetry policy plus order-state query, often seconds
WebSocket command and update stream2-10 ms10-50 msReconnect and resubscribe; replay depends on API support

These ranges are useful for setting a test envelope, not for declaring one protocol faster in every deployment. A colocated FIX client with synchronous disk writes can lose to a well-built REST service. A WebSocket can add little value if its gateway parses JSON slowly or serialises all clients through one process. Compare the same order type, acknowledgement definition, hardware class and network route.

Measure p50, p95 and p99 separately. Averages hide queueing and pause events that matter during bursts.

Capture client send time, gateway receipt, broker acknowledgement and downstream venue acknowledgement where available. Use monotonic clocks within each host, synchronise machines, and report clock uncertainty. If clocks are not aligned, calculate per-hop durations locally rather than subtracting timestamps across hosts.

Build the production path around failure

A practical broker or prop-firm design keeps order intent durable before sending, assigns a stable client order ID, and records every response and state transition. The execution adapter can vary by counterparty while the internal order model remains consistent. Keep provider-specific fields at the edge, and make the mapping of pending, accepted, rejected and partially filled states explicit.

For a first production design, apply these controls:

  • Persist intent and the client order ID before transmission. Define whether a retry reuses the same ID, and test the provider's duplicate behaviour.
  • Track transport state and order state separately. A live socket does not prove that an order is accepted; a dropped session does not prove that it was rejected.
  • On reconnect, stop new risk-increasing orders until the system has reconciled open orders, recent executions and outstanding cancels.
  • Set bounded retry budgets, backoff and rate limits. Treat throttling responses and business rejects differently from network timeouts.
  • Fence active connections during failover. Prevent two workers from sending commands for the same account after a leader change.
  • Alert on sequence gaps, stale execution updates, rising acknowledgement percentiles and differences between internal and broker open-order totals.

Test ambiguous outcomes deliberately. Drop the client connection after the broker receives a new order but before the acknowledgement returns. Repeat for cancel and replace. Restart the adapter with messages queued, then replay a FIX gap or resubscribe to a WebSocket stream. Check that the system neither duplicates exposure nor silently loses a fill. A 30-minute soak at normal traffic will not cover these cases.

Choose a default, then qualify it

For high-rate institutional order flow, FIX is a sensible default where the counterparty supports stable sessions, sequence recovery and clear execution-report semantics. For simple integrations, administrative actions and low-rate order entry, REST can reduce operational complexity. Use WebSockets where persistent updates or a provider's supported command API justify the connection lifecycle and custom recovery work.

Make the decision with a short integration scorecard. Include expected peak messages per second, p99 acknowledgement target, simultaneous sessions, burst limits, replay window, maintenance behaviour, authentication renewal, support escalation and test-environment fidelity.

Ask whether the provider publishes sequence and duplicate-handling rules, not only a latency figure. If those rules are absent, allocate engineering time for state queries and reconciliation.

Keep a production fallback plan separate from protocol choice. That can mean rerouting new orders to another venue, pausing risk-increasing flow, or switching to a controlled manual process. Do not automatically fail over an uncertain order to a second route until its status is known. The extra latency of a query is usually cheaper than creating unintended exposure.

This advice does not apply where a venue mandates a single interface, or where a regulated workflow requires a specific protocol and message record; in that case, meet the mandated contract and engineer recovery around it.

Frequently Asked Questions

Is FIX faster than REST for order entry?

Often, a persistent FIX session has lower overhead than a conventional REST request path, but the protocol alone does not determine latency. Gateway design, network location, message parsing and persistence can change the result. Benchmark the same acknowledgement boundary and report p50, p95 and p99.

Can WebSockets be used to submit trading orders?

Yes, if the broker or venue defines an order-command API over WebSockets. The connection itself does not specify order semantics, duplicate handling or recovery. Confirm how the API reports acceptance and how clients recover updates missed during a disconnect.

How should a trading system handle a timed-out order request?

Do not retry with a new identifier until you know whether the original order reached the broker. Query by the stable client order ID or reconcile open orders and executions. Reuse an identifier for retries only if the counterparty documents its idempotency behaviour.

What should a broker test after a FIX or WebSocket disconnect?

Test gaps, replay or resubscription, duplicate messages, stale updates and orders whose acknowledgement was lost. Reconcile open orders and executions before releasing new risk-increasing flow. Include failover tests that prove two workers cannot send simultaneously for the same account.