developers:websocket:orders

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
developers:websocket:orders [2026/01/26 13:25] – external edit (Unknown date) 127.0.0.1developers:websocket:orders [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
 +<note warning>**Legacy — V1.** This page documents the ''/v1'' WebSocket API and is retained for existing integrations. New development should use [[developers:apiv2|V2]]. See [[developers:apiv2:migrating|Migrating from V1]].</note>
 +
 ===== Order Routing ===== ===== Order Routing =====
  
Line 85: Line 87:
 The **OrderPull** message allows pulling multiple orders at once. The **OrderPull** message allows pulling multiple orders at once.
 </bootnote> </bootnote>
 +
 +==== Routing Orders on Behalf of Another User ====
 +
 +Firms that trade on behalf of their own customers can submit, revise and pull orders for another user without that user being logged in. Set **OnBehalfOfUserName** to the **username** of the user the order belongs to.
 +
 +The **UserId** field continues to identify the authenticated (routing) user - do not put the customer's id there.
 +
 +<bootnote>
 +**OnBehalfOfUserName** is a username, not a user id. Leave it empty or omit it to trade as the authenticated user - existing applications are unaffected.
 +</bootnote>
 +
 +Requirements:
 +
 +  * The authenticated (routing) user must have the **OrderRouting** role. This role is not enabled by default - a firm administrator must enable it on that user before any routed order will be accepted.
 +  * The user named in **OnBehalfOfUserName** must belong to the authenticated user's firm or one of its child firms, and must be enabled and not deleted.
 +  * The account must be one the named user is entitled to trade, and it must be subscribed by the authenticated session.
 +
 +Example **OrderSubmit** on behalf of another user:
 +
 +<code>
 +OrderSubmit {
 +   UserId = "efda0709-af12-4b65-8971-5089edb4aaf0",
 +   OnBehalfOfUserName = "jsmith",
 +   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"
 +      }
 +   ]
 +}
 +</code>
 +
 +The same field is available on **OrderRevise** and **OrderPull**:
 +
 +<code>
 +OrderPull {
 +   UserId = "efda0709-af12-4b65-8971-5089edb4aaf0",
 +   OnBehalfOfUserName = "jsmith",
 +   AccountId = "448c9ddd-6a50-4852-85ea-aad3b6d60620",
 +   MarketId = "XCME_C ZC (H25)",
 +   Pulls = [
 +      {
 +         UniqueId = "a3b1c5f2-7d43-4f9b-88e2-1e2f75c6d9a1"
 +      }
 +   ]
 +}
 +</code>
 +
 +<bootnote>
 +Supply **OnBehalfOfUserName** when revising or pulling a routed order as well. If it is omitted, the revision or cancellation is attributed to the authenticated user rather than to the user the order belongs to.
 +</bootnote>
 +
 +Order validation - roles, entitled exchanges, accounts and permitted order types - is applied using the named user's own settings, not the authenticated user's.
 +
 +Order updates identify both parties, so routed activity remains fully attributable:
 +
 +  * **UserName** - the user the order belongs to.
 +  * **RoutingUserName** - the authenticated user that submitted it.
 +
 +If the named user cannot be resolved - an unknown username, a user outside the firm hierarchy, a disabled or deleted user, or an authenticated user without the **OrderRouting** role - the order is rejected with:
 +
 +<code>
 +Specified user not found
 +</code>
 +
 +<bootnote>
 +Resolved users are cached, so changes to a routed user's roles, accounts or enabled state may not take effect immediately.
 +</bootnote>
 +
  
  
Line 215: Line 291:
          Volume = 1,          Volume = 1,
          StopPrice = "2375.00",          StopPrice = "2375.00",
-         TrailPrice = "50"+         TrailDistance = "50"
       }       }
    ]    ]
Line 344: Line 420:
 An AutoOCO Order is a batch of three orders: An AutoOCO Order is a batch of three orders:
   * A Trigger Order that initiates the trade.   * A Trigger Order that initiates the trade.
-  * Two OCO Orders (Take Profit and Stop Loss) that execute based on the trigger order'fill price.+  * Two OCO Orders (Take Profit and Stop Loss) that are submitted with prices that are differentials to the fill price of the trigger order.
  
 If the Trigger Order fills, the OCO Orders are submitted. If the OCO Orders begin filling, any remaining volume in the Trigger Order is canceled. If the Trigger Order fills, the OCO Orders are submitted. If the OCO Orders begin filling, any remaining volume in the Trigger Order is canceled.
Line 351: Line 427:
  
 <code> <code>
-OrderSubmit +
-   UserId "efda0709-af12-4b65-8971-5089edb4aaf0", +  "UserId": "", 
-   AccountId "448c9ddd-6a50-4852-85ea-aad3b6d60620", +  "HasUserId": false, 
-   MarketId "XCME_C ZC (H25)", +  "AccountId": "60B90323-E72A-4BBF-A129-3882019E622C", 
-   OrderLink = OrderLink.AutoOCO+  "MarketId": "XCME_Eq ES (H26)", 
-   Orders +  "OrderLink": 2
-      +  "ManualOrderIndicator": true, 
-         BuySell = BuySell.Buy+  "Orders": 
-         PriceType = PriceType.Limit+    
-         TimeType = TimeType.Normal+      "BuySell": 1
-         Volume 1, +      "PriceType": 1
-         LimitPrice "2375.00+      "TimeType": 0
-      }, +      "Volume": 1, 
-      +      "MaxShow": 0, 
-         BuySell = BuySell.Sell+      "HasMaxShow": false, 
-         PriceType = PriceType.Limit+      "MaxVolume": 0, 
-         TimeType = TimeType.Normal+      "HasMaxVolume": false, 
-         Volume 0, +      "LimitPrice": { 
-         LimitPrice "2380.00+        "Value": "685800
-      }, +      }, 
-      +      "StopPrice": null, 
-         BuySell = BuySell.Sell+      "TrailDistance": null, 
-         PriceType = PriceType.StopMarket+      "Tag": "", 
-         TimeType = TimeType.Normal+      "HasTag": false, 
-         Volume 0, +      "ActivationType": 0, 
-         StopPrice "2365.00+      "HasActivationType": false, 
-      +      "ActivationData": null 
-   ]+    }, 
 +    
 +      "BuySell": -1
 +      "PriceType": 1
 +      "TimeType": 2
 +      "Volume": 0, 
 +      "MaxShow": 0, 
 +      "HasMaxShow": false, 
 +      "MaxVolume": 0, 
 +      "HasMaxVolume": false, 
 +      "LimitPrice": { 
 +        "Value": "250
 +      }, 
 +      "StopPrice": null, 
 +      "TrailDistance": null, 
 +      "Tag": "", 
 +      "HasTag": false, 
 +      "ActivationType": 1, 
 +      "HasActivationType": true, 
 +      "ActivationData": null 
 +    }, 
 +    
 +      "BuySell": -1
 +      "PriceType": 2
 +      "TimeType": 2
 +      "Volume": 0, 
 +      "MaxShow": 0, 
 +      "HasMaxShow": false, 
 +      "MaxVolume": 0, 
 +      "HasMaxVolume": false, 
 +      "LimitPrice": null, 
 +      "StopPrice": { 
 +        "Value": "125" 
 +      }, 
 +      "TrailDistance": null, 
 +      "Tag": "", 
 +      "HasTag": false, 
 +      "ActivationType": 1, 
 +      "HasActivationType": true, 
 +      "ActivationData": null 
 +    
 +  ]
 } }
 </code> </code>
  • developers/websocket/orders.1769433947.txt.gz
  • Last modified: 2026/01/26 13:25
  • by 127.0.0.1