ข้ามไปยังเนื้อหา

การเทรด

ยกเลิกออร์เดอร์

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.

ยกเลิกออร์เดอร์เดียว

ใช้รูปแบบ DELETE เมื่อมี order ID response ยืนยันการยกเลิก การเรียก DELETE สองครั้งปลอดภัย

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

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

การยกเลิกเป็นกลุ่ม

วางแผนไว้

รองรับสามรูปแบบกลุ่ม: รายการ ID ทุกออร์เดอร์ในหนึ่งตลาด หรือปุ่มฉุกเฉิน — ทุกออร์เดอร์ที่เปิดอยู่ในบัญชี

ในระหว่างนี้ วน single-cancel endpoint ฝั่ง client การยกเลิกฟรีและรวดเร็ว ลูปแน่นบนรายการออร์เดอร์ที่เปิดอยู่ทำงานได้ดีสำหรับการ unwind ฉุกเฉิน

# 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

Panic cancel มีขีดจำกัดอัตราครั้งละสองสามวินาที — ใช้สำหรับการ unwind ฉุกเฉิน ไม่ใช่การไหลปกติ

สิ่งที่ยกเลิกได้

สถานะออร์เดอร์ยกเลิกได้?หมายเหตุ
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 ใช่ (เฉพาะส่วนที่เหลือ) หุ้นที่ fill แล้วยังอยู่ในตำแหน่งของคุณ ยกเลิกเฉพาะส่วนที่ยังไม่ fill
filled ไม่ ชำระบัญชีแล้ว — ไม่สามารถดำเนินการได้
cancelled Idempotent การเรียกซ้ำคืน response ความสำเร็จเดิม

การยกเลิกไม่มีผลย้อนหลัง

ถ้าการยกเลิกมาถึงหลังการจับคู่หนึ่งมิลลิวินาที คุณได้เทรดแล้ว สร้างกลยุทธ์ให้รับมือกับช่วงเวลานั้น — ใช้ IOC หรือ FOK time-in-force ในกรณีที่สำคัญ