본문으로 건너뛰기

트레이딩

주문 생애주기

주문은 제출 순간부터 체결, 취소 또는 만료까지 고정된 상태 집합을 거칩니다. 모든 상태는 API를 통해 관찰할 수 있습니다.

이 챕터의 엔드포인트

네 개의 엔드포인트가 전체 주문 생애주기를 담당합니다. 모든 거래 엔드포인트는 인증과 적절한 스코프가 필요합니다.

HTTP 메서드경로목적
POST /orders 새 주문 제출.
GET /orders/:id ID로 단일 주문 조회.
GET /orders 미결 및 최근 종료된 주문 목록 조회.
POST /orders/:id/cancel 미결 주문 취소.
ACTORClientACTORSatoriEx APIACTORRedis LISTACTORMatcherACTORLedgerACTORWebSocket Hub1POST /orders (validate, escrow funds)2202 Accepted (trades: [])3LPUSH order:pending4BRPOP (pull next order)5match by price-time priority6atomic debit / credit (double-entry)7broadcast trade event over /wsAll seven steps run in the same matcher tick — typical end-to-end latency from POST to WS event is under 500 ms.
The full async flow from a POST /orders call to a trade event delivered over WebSocket. The 202 Accepted (step 2, dashed) lands BEFORE matching runs — your client must await the trade event on /ws to learn the fill outcome.

주문 상태

모든 주문은 이 상태 값 중 하나를 가집니다. 상태 전환은 단방향이며, 부분체결 후 취소만 예외입니다.

ENTRYSubmittedSTATEpendingSTATEopenSTATEpartialSTATEfilledEXITClosedSTATEcancelledPOST /ordersadded to booksome fillsmore fillsfully matchedvalidation failsuser cancelscancel remainder
Transitions are one-way except for the cancel branches: pending, open, and partial can all transition to cancelled by user or admin action. A circuit-breaker halt pauses the market but leaves resting orders intact — cancellation is still your decision. Cancelling a partial order removes only the unfilled remainder.
상태의미
pending반대 주문을 기다리며 오더북에 대기 중.
open오더북에서 반대 주문을 기다리며 대기 중입니다.
partial일부 체결됨. 나머지는 여전히 대기 중.
filled완전히 매칭됨. 주식이 포지션에 추가됩니다.
cancelledCancelled by the user or by an admin action. The circuit breaker halts the market on a 30%+ price move but does not automatically cancel resting orders — they are paused until trading resumes (or you cancel them yourself).

일반적인 거부 사유

주문이 거부되면 응답에 안정적인 오류 코드가 포함되어 클라이언트가 분기할 수 있습니다.

코드심볼의미
3001 ErrInsufficientBalance 제안된 가격의 주문을 처리하기에 USDC 잔액이 부족합니다.
5002 ErrInvalidPrice 가격이 마켓의 허용 틱 범위를 벗어나거나 0 미만 / 1 초과입니다.
5004 ErrInvalidSide side must be 1 (buy) or 2 (sell) — any other value is rejected.
5007 ErrMarketNotTrading 마켓이 중단됨(서킷 브레이커, 해소, 또는 유지보수).
5008 ErrInsufficientPosition you do not hold enough shares of this outcome to place this sell order.
2025 ErrTwoFactorRequired 2FA is required for trading — enable it in Security settings before placing orders.

message가 아닌 숫자 `code` 필드로 분기하십시오 — 메시지는 사용자용이며 로케일과 플랫폼 문구에 따라 변경됩니다.

폴링 대신 주문 이벤트 구독

WebSocket 주문 채널은 실시간으로 상태 전환을 푸시합니다. 체결에 반응해야 하는 봇에는 WebSocket을 사용하세요. 폴링은 대시보드에는 허용되지만 거래 루프에는 비효율적입니다.