Typical workflow
- Subscribe to MarketDataSnapshot for the relevant securities.
- Subscribe to ExecutionReport with
StartDateset to theTimestampof the last ExecutionReport you processed, to recover order state. - Subscribe to Trade with
StartDateset to theTimestampof the last Trade you processed, to recover any missed trades. - Keep a map of
OrderIDto the last ExecutionReport received for each open order. - Keep a set of the
ClOrdIDof each pending request. - To submit an order, generate a new
ClOrdIDand send a NewOrderSingle with theClOrdID,Side,Price,OrderQty,Strategyand other fields for the request. - The response arrives on the ExecutionReport stream with the
ClOrdIDfrom the NewOrderSingle. If the order is accepted (ExecTypePendingNew), add it to your open orders. - To cancel or modify an open order, generate a new
ClOrdIDand send an OrderCancelRequest or OrderCancelReplaceRequest with thatClOrdID, theOrderIDor theOrigClOrdIDfrom the previous successful request, and the remaining fields. - Fills arrive as ExecutionReport messages with
ExecTypeTrade.
Order state change matrices
Order states and transitions on the WebSocket API follow FIX 4.4 closely. The main difference is how a rejected cancel or replace is reported. In FIX 4.4, and on the Prime FIX API, it arrives as a separate OrderCancelReject message. The WebSocket API has no OrderCancelReject message: it sends an ExecutionReport withExecType CancelRejected or ReplaceRejected instead.
In the tables below, A and B are ClOrdID values. A response shown as (B,A) has ClOrdID B and OrigClOrdID A. Rows with the same time are alternatives.
Filled order
An order with
CumQty > 0 receives ExecutionReports with CumQty set to the filled size. An order that is partially filled and then canceled receives an ExecutionReport with the terminal status Canceled and CumQty > 0.