Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ==== Order Routing ==== The WebSocket API provides real-time order routing, allowing clients to submit, revise, and pull orders. [[developers:websocket#message_structure_overview|All order-related operations are sent within a **ClientMessage** envelope and responses are received within a **ServerMessage** envelope.]] This section covers: * Submitting Orders * Revising Orders * Pulling Orders * Handling Order Updates A **C# helper tool** is available to assist developers in constructing order messages. **[Repository Placeholder - Add Link]** === Submitting an Order === To submit an order, clients must send an **OrderSubmit** message. This includes key details such as the **account ID, market ID, order type, price, and volume**. Example **OrderSubmit** message: <code> message ClientMessage { oneof payload { OrderSubmit order_submit = X; } } message OrderSubmit { string user_id = 1; string account_id = 2; string market_id = 3; repeated Order orders = 4; message Order { BuySell buy_sell = 1; PriceType price_type = 2; TimeType time_type = 3; int32 volume = 4; optional Price limit_price = 5; } } </code> 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: <code> 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; } </code> 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: <code> message ClientMessage { oneof payload { OrderPull order_pull = X; } } message OrderPull { string order_id = 1; } </code> 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: <code> 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; } </code> Developers should listen for **OrderUpdate** messages to track order execution status. This structure ensures a **consistent, efficient**, and **real-time** approach to order routing. developers/websocket/orders.txt Last modified: 2025/03/14 20:18by chad