The V3 combo order sample is missing a combo_order_id for the order. here is the add
# combo equity order
client_combo_order_id = uuid.uuid4().hex # add this for the overall id for the combo order
master_equity_client_order_id = uuid.uuid4().hex
stop_profit_equity_client_order_id = uuid.uuid4().hex
stop_loss_equity_client_order_id = uuid.uuid4().hex
print('normal_equity_master_client_order_id:', master_equity_client_order_id)
print('stop_profit_equity_client_order_id:', stop_profit_equity_client_order_id)
print('stop_loss_equity_client_order_id:', stop_loss_equity_client_order_id)
new_combo_orders = [
{
"client_order_id": master_equity_client_order_id,
"combo_type": "MASTER",
"symbol": "F",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "LIMIT",
"quantity": "1",
"support_trading_session": "N",
"limit_price": "10.5",
"side": "BUY",
"entrust_type": "QTY",
"time_in_force": "DAY"
},
{
"client_order_id": stop_profit_equity_client_order_id,
"combo_type": "STOP_PROFIT",
"symbol": "F",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "LIMIT",
"quantity": "1",
"support_trading_session": "N",
"limit_price": "11.5",
"side": "SELL",
"entrust_type": "QTY",
"time_in_force": "DAY"
},
{
"client_order_id": stop_loss_equity_client_order_id,
"combo_type": "STOP_LOSS",
"symbol": "F",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "STOP_LOSS",
"quantity": "1",
"support_trading_session": "N",
"stop_price": "10",
"side": "SELL",
"entrust_type": "QTY",
"time_in_force": "DAY"
}
]
res = trade_client.order_v3.preview_order(account_id, new_combo_orders, client_combo_order_id) # add the client_combo_order_id here
if res.status_code == 200:
print('preview combo equity order res:', res.json())
res = trade_client.order_v3.place_order(account_id, new_combo_orders, client_combo_order_id) # add the client_combo_order_id here
if res.status_code == 200:
print('place combo equity order res:', res.json())
sleep(3)
replace_combo_orders = [
{
"client_order_id": master_equity_client_order_id,
"quantity": "2"
},
{
"client_order_id": stop_profit_equity_client_order_id,
"quantity": "2"
},
{
"client_order_id": stop_loss_equity_client_order_id,
"quantity": "2"
}
]
res = trade_client.order_v3.replace_order(account_id, replace_combo_orders, client_combo_order_id) # add the client_combo_order_id here
if res.status_code == 200:
print('replace combo equity order res:', res.json())
sleep(3)
res = trade_client.order_v3.cancel_order(account_id, client_combo_order_id) # add the client_combo_order_id here
if res.status_code == 200:
print('cancel master equity order res:', res.json())
res = trade_client.order_v3.get_order_history(account_id)
if res.status_code == 200:
print('get order history res:', res.json())
res = trade_client.order_v3.get_order_open(account_id=account_id)
if res.status_code == 200:
print("order_open_res=" + json.dumps(res.json(), indent=4))
res = trade_client.order_v3.get_order_detail(account_id, client_combo_order_id)
if res.status_code == 200:
print('get master order detail res:', res.json())
The V3 combo order sample is missing a combo_order_id for the order. here is the add