Skip to content

撤單 ​

POST /api/v1.0/sim-trade/{acc_id}/orders/{order_id}/cancel

撤銷未成交的訂單。僅 status=2(已提交)的訂單可撤。

請求參數 ​

參數類型位置必填說明
acc_idstringpath是業務賬戶 ID
order_idstringpath是要撤銷的訂單 ID
marketintbody是市場(來自賬戶列表的 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_idint64被撤銷的訂單 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"}
}