跳至主要内容

批量撤銷委託單

該接口可以批量撤銷多筆訂單

重要
  • 您必須指定orderId或者orderLinkId.
  • orderIdorderLinkId之間不匹配, 系統將會優先處理orderId.
  • 您只能撤銷未成交和部分成交的訂單.
  • 最多支持單個請求中撤銷, 期權: 20個訂單, 反向合約: 10個訂單, 正向合約: 10个訂單, 現貨: 10個訂單.

HTTP請求

POST /v5/order/cancel-batch

請求參數

參數是否必需類型說明
categorytruestring產品類型
  • 統一帳戶2.0: linear, option, spot, inverse
  • 統一帳戶1.0: linear, option, spot
  • requesttruearrayObject
    > symboltruestring合約名稱
    > orderIdfalsestring訂單Id. orderIdorderLinkId必傳其中一個
    > orderLinkIdfalsestring用戶自定義訂單Id. orderIdorderLinkId必傳其中一個

    響應參數

    參數類型說明
    resultObject
    > listarrayObject
    >> categorystring產品類型
    >> symbolstring合約名稱
    >> orderIdstring訂單Id
    >> orderLinkIdstring用戶自定義訂單Id
    retExtInfoObject
    > listarrayObject
    >> codenumber成功/錯誤碼
    >> msgstring成功/錯誤信息
    信息

    ack僅表示請求被成功接受. 請使用websocket-order推送來確認訂單狀態


    請求示例

    POST /v5/order/cancel-batch HTTP/1.1
    Host: api-testnet.bybit.com
    X-BAPI-SIGN: XXXXX
    X-BAPI-API-KEY: XXXXX
    X-BAPI-TIMESTAMP: 1672223356634
    X-BAPI-RECV-WINDOW: 5000
    Content-Type: application/json

    {
    "category": "spot",
    "request": [
    {
    "symbol": "BTCUSDT",
    "orderId": "1666800494330512128"
    },
    {
    "symbol": "ATOMUSDT",
    "orderLinkId": "1666800494330512129"
    }
    ]
    }

    響應示例

    {
    "retCode": 0,
    "retMsg": "OK",
    "result": {
    "list": [
    {
    "category": "spot",
    "symbol": "BTCUSDT",
    "orderId": "1666800494330512128",
    "orderLinkId": "spot-btc-03"
    },
    {
    "category": "spot",
    "symbol": "ATOMUSDT",
    "orderId": "",
    "orderLinkId": "1666800494330512129"
    }
    ]
    },
    "retExtInfo": {
    "list": [
    {
    "code": 0,
    "msg": "OK"
    },
    {
    "code": 170213,
    "msg": "Order does not exist."
    }
    ]
    },
    "time": 1713434299047
    }