modifyOrderStrategy command schema

Now that API bracket orders are working :raised_hands:, can someone provide an example of what a command body string typically looks like? The documentation is extremely vague!

1 Like

bump post I would like to know as well

+1 I would love to see an example of this as well

This is how I send it to the websocket. The user data comes from a user sync from the websocket.

fn place_bracket_limit_order(&mut self, user_data: &UserSyncData, qty: i64, price: f64,
    take_profit: f64, stop_loss: f64, trailing_stop: bool, symbol: &str, action: &str){
        let params = json!({
        "entryVersion": {
            "orderQty": qty,
            "orderType": "Limit",
            "price": price
        "brackets": [{
            "qty": qty,
            "profitTarget": take_profit,
            "stopLoss": stop_loss,
            "trailingStop": trailing_stop
    let body = json!({
        "accountId": user_data.accounts[0].id,
        "accountSpec": user_data.accounts[0].name,
        "symbol": symbol,
        "action": action,
        "orderStrategyTypeId": 2,
        "is_automated": true,
        "params": params.to_string()
    let endpoint: &str = "orderStrategy/startOrderStrategy";
    let body_string: String = format!("\n{}", body.to_string());//This endpoint requires an extra newline before body because it's a POST endpoint
    self.socket_request(endpoint, body_string, None);
1 Like

Nice work @Epictetzu. You might be our first Rustacean!

:+1:It helped me understand it better if I just did it in rust. And thanks for all your tutorials and forum posts. They were enough that I didn’t have any questions without answers already on the forum.

1 Like

Wow, very cool to see everyone’s implementations!

One thing I will say is that the original question was asking about the modifyOrderStrategy command body, not startOrderStrategy.

This (from the API documentation) is not very instructive:

However, I will share what I learned about submitting bracket orders.

When you send an order via startOrderStrategy, it reserves a contiguous block of order ids and assigns them to separate orders. If you want to modify the strategy, you need to dissect how the API is reserving each of the order ids and use modifyOrder to modify that specific order.

It is a lot more opaque than using individual orders – it still suffers from p-time delays (without telling you), and honestly, it is not very reliable (many order blocks are assigned inconsistently). After playing around with startOrderStrategy for a couple weeks, I decided to scrap using it altogether and go back to manually recreating brackets using individual orders.

1 Like

but the quetion is modifyorderstrategy,the api doc schema demo is

  "orderStrategyId": 60783294,
  "command": "tempor reprehenderit",
  "customTag50": "nulla id"

but who knows the command formate or demo? @Alexander

I use this method to soft this problem
1: the strategy main order is not filed:
you can cancel first and send a new strategy order
2:the strategy main order is filed:
you can recored the bracket order and one by one modify modify them use the API modifyorder

  "orderId": 111111,
  "orderQty": 1,
  "orderType": "Stop",
  "stopPrice": 3700.00,
  "timeInForce": "Day",
  "isAutomated": true