Understanding how an order moves through states is critical for systematic trading. This page documents every state, what triggers each transition, and how to observe them across the three API protocols.Documentation Index
Fetch the complete documentation index at: https://kraken-sandbox.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
State machine
States
| State | Description |
|---|---|
pending | Order has been accepted but not yet processed by the trading engine |
open | Order is live in the order book, awaiting a match |
partially_filled | One or more partial fills have occurred; remainder is still open |
filled (closed) | Order has been fully matched |
canceled (closed) | Order was canceled — by the user, by COD, by cancelAllOrdersAfter, or by the system |
expired (closed) | GTD (Good Till Date) order whose expiry time was reached |
State transitions
| From | To | Trigger |
|---|---|---|
| — | pending | Order accepted by OES/FIX Gateway |
pending | open | Validated and placed in the order book |
pending | canceled | Validation failure (insufficient funds, invalid params, rate limit) |
open | partially_filled | Partial match in the trading engine |
open | filled | Full match in the trading engine |
open | canceled | User cancel, COD disconnect, cancelAllOrdersAfter deadline, cancelAll |
open | expired | GTD order expiry reached |
partially_filled | partially_filled | Additional partial fill |
partially_filled | filled | Final fill clears remaining quantity |
partially_filled | canceled | Remaining quantity canceled (IOC residual, user cancel, reduce-only limit) |
Observing state by API
REST
UseOpenOrders to see live orders and ClosedOrders / QueryOrders for historical state. The status field returns the current state string.
status:open,pending,closed,canceled,expiredvol_exec: volume filled so farreason: populated on cancellation (e.g."User requested","Order would trigger immediately")amended: boolean,trueif the order was ever amended
WebSocket v2
Subscribe to theexecutions channel for real-time state changes. Every state transition produces a message.
exec_type values:
exec_type | Meaning |
|---|---|
new | Order placed in the book |
trade | Partial or full fill |
canceled | Order canceled |
expired | GTD expiry |
amended | Order was amended (price, quantity, or both) |
status | State confirmation with no change (e.g. on reconnect snapshot) |
restated | Order state was restated, typically after a system event |
liquidated | Order was forcibly closed by the risk system |
WebSocket v1
Subscribe toopenOrders for live state updates. The feed sends a snapshot on subscribe, then incremental updates.
FIX
ExecutionReport (MsgType=8) is the primary message for order state. Key tags:| Tag | Field | Values |
|---|---|---|
| 39 | OrdStatus | 0=New, 1=Partial fill, 2=Filled, 4=Canceled, 6=Pending cancel, 8=Rejected, C=Expired |
| 150 | ExecType | 0=New, 1=Partial fill, 2=Fill, 4=Canceled, 8=Rejected, C=Expired, D=Restated, G=Trade correct |
| 58 | Text | Human-readable reason on rejection or cancellation |
| 14 | CumQty | Total quantity filled |
| 151 | LeavesQty | Remaining open quantity |
Amendment and queue priority
When you amend an order, queue priority behaviour depends on what changed:| Amendment type | Queue priority |
|---|---|
| Reduce quantity only | Preserved — the order keeps its time priority |
| Increase quantity | Lost — order moves to back of queue at that price |
| Change price | Lost — order moves to back of queue at the new price |
Special cancellation triggers
Cancel on Disconnect (COD) — FIX only When a FIX session disconnects, all orders placed on that session are automatically canceled. COD is configured at the session level during onboarding. Dead Man’s Switch — all APIsCancelAllOrdersAfter sets a countdown timer. If not refreshed before expiry, all open orders are canceled. Use this as a safety net against connectivity issues.
timeout=0.
IOC — Immediate or Cancel
Orders with time_in_force=IOC fill immediately at the available best price and the unfilled remainder is instantly canceled with reason: "Immediate or cancel".
Reduce-only cancellation
If a reduce-only order would flip a position, it matches as much as possible and the remainder is canceled with EOrder:Reduce only:Position is closed.
Self-trade prevention
Self-trade prevention (STP) prevents your orders from matching against each other. Configure at the order level:| Mode | FIX Tag 7928 | REST stp_type | Behaviour |
|---|---|---|---|
| Cancel newest (default) | 1 | cancel-newest | Arriving order is canceled |
| Cancel oldest | 2 | cancel-oldest | Resting order is canceled |
| Cancel both | 0 | cancel-both | Both orders are canceled |
Related guides
API comparison
Choose between REST, WebSocket, and FIX for order management
Error reference
Order error codes and cancellation reason strings
WebSocket reconnection
Reconcile order state after a disconnect
Order amends
Amend price or quantity without losing queue priority
Rate limits
How order placement and cancellation consume rate limit
FIX ExecutionReport
FIX MsgType=8 — full field reference for order state messages