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.