跳至主要內容

撤單

描述​

撤銷訂單

  • 未成交或部分成交的限價單(NEW、PARTIALLYFILLED,部分查詢接口回傳 PARTIALLY_FILLED)可撤銷未成交的剩餘數量。適用於仍在掛單的訂單。
  • 未觸發的條件單或止盈止損單(UNTRIGGERED)可在觸發前撤銷。
  • 已觸發的條件單(TRIGGERED)轉為活動限價單後,若仍可掛單且有未成交數量,可按活動限價單撤銷。

HTTP 請求​

  • POST /api/v3/order/cancel
  • 適用產品:spot / linear
  • 限頻規則:10次 / S / UID

請求參數​

欄位類型必填說明
categorystring是產品類型
symbolstring是交易對
orderIdstring否系統訂單ID(與 orderLinkId 二選一)
orderLinkIdstring否自定義訂單ID(與 orderId 二選一)
orderFilterstring否Order(通用)/ tpslOrder(現貨止盈止損)/ StopOrder(合約條件單),默認 Order

回應參數​

欄位類型說明
orderIdstring已撤訂單ID
orderLinkIdstring自定義訂單ID

請求示例​

POST /api/v3/order/cancel HTTP/1.1
Host: openapi.lbank.com
Content-Type: application/json
ex-api-key: <your_api_key>
ex-timestamp: <current_unix_timestamp_ns>
ex-nonce: <unique_random_hex>
ex-signature: <your_signature>
ex-client-type: API

{
"category": "linear",
"symbol": "BTCUSDT",
"orderId": "<existing_order_id_1>",
"orderFilter": "Order"
}

回應示例​

HTTP/1.1 200 OK
Content-Type: application/json

{
"code": 200,
"message": "Success",
"data": {
"orderId": "<existing_order_id_1>",
"orderLinkId": "b320fe1a-478c-4d2e-a219-000000000003"
},
"extras": null
}