コンテンツへスキップ

トレーディング

注文ライフサイクル

注文は送信した瞬間から約定、キャンセル、または期限切れになるまで固定の状態セットを経由します。全ての状態はAPIで観察できます。

この章のエンドポイント

4つのエンドポイントが注文ライフサイクル全体をカバーします。全ての取引エンドポイントは認証と適切なスコープが必要です。

メソッドパス目的
POST /orders 新規注文を送信します。
GET /orders/:id IDで1件の注文を取得します。
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`フィールドで分岐してください — messageはユーザー向けでロケールやプラットフォームコピーによって変わります。

ポーリングではなく注文イベントを購読してください

WebSocket注文チャンネルは状態遷移をリアルタイムにプッシュします。約定に反応する必要があるボットにはこれを使用してください — ポーリングはダッシュボードには許容されますが取引ループには非効率です。