This is an old revision of the document!
Order Routing
The WebSocket API provides real-time order routing, allowing clients to submit, revise, and pull orders. All order-related operations are sent within a **ClientMessage** envelope and responses are received within a **ServerMessage** envelope.
Submitting an Order
To submit an order, clients send an OrderSubmit message.
Note: You must subscribe to the Account before submitting an order into it. Orders will be rejected if the account is not subscribed.
Example OrderSubmit message:
OrderSubmit { UserId = "efda0709-af12-4b65-8971-5089edb4aaf0", AccountId = "448c9ddd-6a50-4852-85ea-aad3b6d60620", MarketId = "XCME_C ZC (H25)", Orders = [ { BuySell = BuySell.Buy, PriceType = PriceType.Limit, TimeType = TimeType.Normal, Volume = 5, LimitPrice = "4200.50" } ] }
The OrderSubmit message allows submitting multiple orders at once, each with its own BuySell, PriceType, and TimeType.
Revising an Order
To revise an existing order, clients must send an OrderRevise message. This allows modifying key parameters such as price, volume, and time type, but the market and buy/sell direction cannot be changed.
Example OrderRevise message:
message ClientMessage { oneof payload { OrderRevise order_revise = X; } } message OrderRevise { string order_id = 1; optional Price new_limit_price = 2; optional int32 new_volume = 3; optional TimeType new_time_type = 4; }
Only fields that need to be changed should be included.
Pulling (Cancelling) an Order
To cancel an order, clients must send an OrderPull message with the order ID.
Example OrderPull message:
message ClientMessage { oneof payload { OrderPull order_pull = X; } } message OrderPull { string order_id = 1; }
Once an order is successfully canceled, an OrderUpdate message will be sent in the ServerMessage.
Handling Order Updates
All order state changes, including new orders, fills, revisions, and cancellations, are communicated via the OrderUpdate message.
Example OrderUpdate message:
message ServerMessage { oneof payload { OrderUpdate order_update = X; } } message OrderUpdate { string order_id = 1; OrderStatus status = 2; optional Price filled_price = 3; optional int32 filled_volume = 4; }
Developers should listen for OrderUpdate messages to track order execution status.
This structure ensures a consistent, efficient, and real-time approach to order routing.