撤單
POST/api/v1.0/sim-trade/{acc_id}/orders/{order_id}/cancel撤銷未成交的訂單。僅 status=2(已提交)的訂單可撤。
請求參數
| 參數 | 類型 | 位置 | 必填 | 說明 |
|---|---|---|---|---|
acc_id | string | path | 是 | 業務賬戶 ID |
order_id | string | path | 是 | 要撤銷的訂單 ID |
market | int | body | 是 | 市場(來自賬戶列表的 market_id) |
請求示例
bash
curl -s -X POST "https://webapi.moomoo.com/api/v1.0/sim-trade/80303779/orders/1270776/cancel" \
-H "Authorization: Bearer <AccessToken>" \
-H "Content-Type: application/json" \
-d '{"market":1}' | jq響應欄位
| 欄位 | 類型 | 說明 |
|---|---|---|
order_id | int64 | 被撤銷的訂單 ID |
響應示例
json
{
"ret_code": 0,
"ret_msg": "success",
"data": {
"order_id": 1270776
}
}錯誤響應
HTTP 狀態仍為 200。請求失敗時返回非 0 的 ret_code 和 error 物件。
json
{
"ret_code": -3,
"ret_msg": "invalid request",
"error": {"code": "invalid_parameter", "message": "invalid request"}
}