跳到內容

交易

取消委託

Cancellation is free, best-effort, and idempotent. Today you can cancel one order at a time per request. Bulk cancel — by ID list, by market, or account-wide — is planned; see the workaround below until it ships. A race window exists in all modes: in-flight fills committed before your cancel reaches the matcher will still complete.

取消單筆委託

當您有委託 ID 時使用 DELETE 形式。回應確認取消;兩次呼叫 DELETE 是安全的。

POST /api/v1/orders/:id/cancel
Authorization: Bearer $SATORIEX_TOKEN

202 Accepted  -> { "code": 0, "data": { ...full order object with status "cancelled" } }

批量取消

規劃中

支援三種批量模式:ID 列表、某個市場上的所有委託,或緊急按鈕——帳號上的所有未成交委託。

在此期間,請在客戶端循環呼叫單筆取消端點。取消操作免費且快速,因此對您的未成交委託列表進行緊密循環非常適合緊急平倉。

# Today: cancel one order at a time.
for id in "${ORDER_IDS[@]}"; do
  curl -X POST https://staging.satoriex.io/api/v1/orders/$id/cancel \
    -H "Authorization: Bearer $SATORIEX_TOKEN"
done

緊急取消有速率限制,每幾秒鐘只能執行一次——它用於緊急平倉,而非正常流程。

可以取消的委託

委託狀態可取消?備註
pending Flagged for cancel; the matcher skips it on next processing — the order has not yet been added to the book.
open Resting in the book; cancel removes it immediately. This is the common cancel case.
partial 是(僅剩餘部分) 已成交的份額保留在您的持倉中;只有未成交的剩餘部分被取消。
filled 已清算——不可操作。
cancelled 等冪性 重複呼叫回傳相同的成功回應。

取消不具追溯效力

若您的取消請求在撮合後一毫秒到達,您已完成交易。請建構您的策略以容忍這個視窗——在此情況重要的地方使用 IOC 或 FOK 有效期限。