Skip to main content
Spot and perps share order entry, order management, and live streams. Spot orders spend vault balances; perps orders (tradingMode: "MARGIN") add leverage, risk buckets, and reduce-only controls.

Surface Map

Before You Build

Place Orders

Trading requires an authenticated session. Resolve a trading pair UUID, then pass it to order methods.

Limit Orders

Fill at the limit price or better; can rest. Default GTC.

Market Orders

Fill immediately, bounded by slippageTolerance and the market’s protective price band.

Time in Force

GTC expires at expirationDate, or 90 days after placement if omitted; past it, takers skip it and it ends EXPIRED with an OrderExpired event. An IOC/FOK that cannot fill is accepted then rejected: 2xx with matchResult.status: "REJECTED". A success response does not mean the order executed — read matchResult.status.

Post-Only Orders

postOnly: true makes a limit order maker-only. If it would cross on arrival (BUY at or above best ask, SELL at or below best bid), it is rejected: REST 400 / gRPC InvalidArgument, code POST_ONLY_WOULD_CROSS. Otherwise it rests like any limit order.
  • REST puts the code in the error envelope code; gRPC attaches google.rpc.ErrorInfo (reason = code, domain = matching-engine.0xmonaco.com); batch items use error.code. Match the code, not the message.
  • Only valid with LIMIT + GTC; rejected on MARKET or with IOC/FOK.
  • Echoed as postOnly: true on order reads; absent otherwise.
  • Replacements set their own postOnly; it is never inherited. See Replace Orders and Batch Replace for the original’s fate.

Self-Trade Prevention

selfTradePreventionMode sets what happens when your order would match your own resting order: CANCEL_MAKER (default; cancel your resting order and keep matching), CANCEL_TAKER, CANCEL_BOTH, or SKIP (trade around it). Set it per create, replace, or batch item, or set a wallet default with PUT /api/v1/accounts/self-trade-prevention (sdk.profile.setSelfTradePreventionDefault). “Your own” spans every subaccount and application on the wallet address. Affected orders end CANCELLED with terminalReason: "SELF_TRADE_PREVENTION", not an error — except a FOK under CANCEL_BOTH whose fill path hits your own order, which is rejected with SELF_TRADE_NOT_ALLOWED. Details: Self-Trade Prevention.

Safe Retries with Idempotency Keys

idempotencyKey makes a create safe to retry. clientOrderId does not.
TypeScript SDK. placeLimitOrder, placeMarketOrder, and each batchCreate item always send a key, generating a UUID if you omit one (React hooks and MCP tools inherit this). A call without your own key is a new submission; to recover across calls or restarts, persist your own key first.
  • With an SDK-generated key, single creates resend on an unknown outcome (network error, unreadable success body, or 5xx including ORDER_SUBMISSION_UNAVAILABLE) up to 3 more times after 1, 2, and 4 s, or after a longer Retry-After. They return immediately on OPERATIONS_BLOCKED, any 4xx, or Retry-After over 5 s, and stop 60 s after the first send or when the SDK session changes.
  • A key you supply is sent once; you own its retries. batchCreate always sends once.
  • If a resend is refused (e.g. 429), the error reports the outcome as unknown, with no status code and the refusal as cause. If every attempt is ambiguous, the APIError message names the key and requestBody holds the body with it.
Retryable codes. Both are 503 / UNAVAILABLE (per-item error in a batch). Retry the same key and payload with bounded backoff. Never mint a new key for an already-submitted order: the original may still commit.
  • ORDER_SUBMISSION_CAPACITY_EXCEEDED — a new key was refused: receipt storage is full, or your share is (10,000 unevictable receipts or 32 MiB per user and application). Nothing applied, key not reserved. Existing keys still replay; unkeyed orders and other users are unaffected. Usually clears within seconds.
  • ORDER_SUBMISSION_UNAVAILABLE — the stored result for a key is unreachable now, or keyed admission is busy. Outcome unknown, not rejected.
Batches. Keep per-item keys to retry across calls; an item’s key also works through single create. Keys protect only their item — no all-or-nothing, and only keyed items are safe to retry. Keyed or not, a batch runs as one matching-engine step: items are placed in input order with no other submission between them, results keep input positions, and failures do not roll back siblings. A key repeated within one batch is placed at most once: a repeat of the same order returns the first item’s result, and a different order under that key is judged like a retry against the key’s receipt: it returns that order’s original result when the receipt answers it and IDEMPOTENCY_KEY_CONFLICT when the receipt holds another order. When no receipt was recorded, for example because the first item was refused for capacity, the repeat answers ORDER_SUBMISSION_UNAVAILABLE: treat its outcome as unknown and retry it with the same key. An overloaded engine places nothing and answers OVERLOADED either for the whole request (503 / UNAVAILABLE) or, when its queue is full, on each item that passed validation in a 200 response; both are safe to retry with the same keys. Raw REST/gRPC. The key is optional today; a future release will require it on every create and batch item. Generate and retain keys before serialization and signing.

Client Order IDs

clientOrderId is your label, echoed back. It is not an idempotency key: a duplicate is rejected (where the guard applies), never answered with the original, and the rest of the payload is not compared.
  • Set on placeLimitOrder, placeMarketOrder, replaceOrder, batchCreate, batchReplace.
  • Returned on order reads and order WebSocket events (OrderPlaced, taker and maker fills, cancel, expiry, post-acceptance OrderRejected). Maker fills carry the resting order’s value. Some older orders omit it.
  • Up to 64 chars from A-Za-z0-9._:-; whitespace trimmed; blank = absent. Otherwise 400 / INVALID_ARGUMENT, or per-item INVALID_CLIENT_ORDER_ID in a batch (a failed batchReplace item never touches its original).
Uniqueness. Only one of your resting orders may hold a value at a time (per user, never global).
  • Conflict: single create/replace returns 409 CLIENT_ORDER_ID_CONFLICT naming the holder; a batch returns 2xx with that item’s error.code CLIENT_ORDER_ID_CONFLICT. The check runs on live state, so it is reliable.
  • Orders that never rest (MARKET, IOC, FOK, a limit filled on arrival) never take the value.
  • The value frees on a terminal state, so a per-quote label can be reused, and a replacement can restate its original’s value (distinguish them by orderId). If you reconcile by clientOrderId, use a fresh value per create: after reuse, an event or lookup may match the earlier order.
Lost response without an idempotency key: do not resubmit. Resubmitting with the same clientOrderId returns 409 only if the first attempt is still resting. If it executed (market, IOC/FOK, marketable limit) or has since filled or been cancelled, the resubmission is accepted as a new order and can execute again.

Recovering from a lost response

  1. Subscribe before you place (sdk.ws.userOrders(handler) or sdk.ws.orders(pairId, mode, handler)). The stream is not replayable: a late subscription misses earlier events, there is no sequence number to backfill, and close code 1013 means a gap on the whole connection (details).
  2. A matching event proves acceptance. A market order filled on arrival emits OrderPlaced then OrderFilled.
  3. Silence proves nothing. Events can be missed while the connection looks healthy.
  4. Check whether your position or balance moved — the economic truth for a taking order.
  5. Don’t poll the order list. Order history can lag a few seconds and report “not found” for an order that landed. A missing row is not evidence; a REJECTED row is.
  6. If unresolved, hold. A wrongful resubmit doubles exposure; a missed quote can be re-quoted.

Perps Order Options

Monaco resolves the parent margin account and risk bucket; marginAccountId is an optional override.
riskBucketCollateral is the bucket’s own collateral and stays until you release it; omitted, the bucket starts empty. See Margin Accounts. riskBucketId must be the order’s margin account’s cross bucket or its isolated bucket for the pair; it does not choose the account, so pair a sub-account’s bucket with that sub-account’s marginAccountId or strategyKey (a reduce-only or TP/SL close sending only the bucket id is a default-account order and is refused). Errors (400): riskBucketId does not belong to marginAccountId; riskBucketId does not belong to marginMode ISOLATED for the cross bucket under an explicit ISOLATED (a margin order with no marginMode is ISOLATED); the margin account is closed on a closed sub-account. One margin mode per market. While the margin account holds the pair in the other mode (open position, non-reduce-only resting order, or live non-reduce-only TWAP), a non-reduce-only order, replace, or TWAP is rejected 400 MARGIN_MODE_CONFLICT, naming the holding bucket. Reduce-only always passes; cancels work on either side. A collateral transfer gets the same error only if it would create a second live isolated bucket for the pair; idle collateral elsewhere is fine but cannot open exposure. On an isolatedOnly market, a non-reduce-only CROSS order is rejected 400 CROSS_MARGIN_NOT_ALLOWED. See One margin mode per market. Margin admission is the only collateral check:
  • Bucket collateral covers the order first; any shortfall to initial margin is drawn atomically from the parent’s unallocated capacity. The draw returns on cancel and never affects liquidation price.
  • Charged: a crossing order pays initial margin at mark, each fill’s loss vs mark, and taker fee. A resting order pays initial margin at its limit and maker fee — or, if it rests through the live mark, is charged as if filled now.
  • Only the part that opens or flips a position is charged. A close is never refused for its loss (in liquidation zero mode its price is bounded by the bucket’s bankruptcy price — see Perp price band).
  • A bucket below initial margin also draws its gap when an opening, adding, or flipping order arrives. If the parent cannot fund both, the order is refused if it adds requirement, else it passes without the draw (smaller replace, flip no larger than the position; a fee counts as adding).
  • A pure close is never refused for margin, unless another resting order in the bucket still opens a position — then it is judged as adding (cancel that order first). Any order placed while an opening order rests on an under-margined bucket draws the gap if the parent can fund it.
  • Never rechecked on fill. Fills keep what positions need and return the rest; cancels, smaller replaces, and IOC remainders return what resting orders no longer need, and once none opens a position, everything not kept for a position returns.
  • Liquidation freezes reject new orders. Size with simulation and availableOrderCollateral; parent headroom does not guarantee admission.

Risk Buckets and Pre-Trade Simulation

Simulate on debounced form changes, show rejectReason, and block submission when accepted is false.
For a specific bucket or sub-account, call sdk.marginAccounts.simulateRiskBucketOrderRisk (POST /api/v1/margin/risk-buckets/simulate-order-risk) with marginMode "ISOLATED" (default) or "CROSS".
  • Isolated models the bucket a first order would create. Cross works before any cross order; its scope is markets with an open cross position, reported with the previewed pair in selectedTradingPairIds.
  • Refusal: rejectReason and rejectCode match placement (e.g. MARGIN_MODE_CONFLICT, INSUFFICIENT_LIQUIDITY for an IOC that won’t fill). rejectCode is absent on a server fault, with a generic retry rejectReason.
  • Previews run placement’s own refusals with its reason and code (the one placement reports when several apply): closed pair, inactive application (margin reduce-only excepted), CROSS on an isolated-only market, post-only regime, resting-order caps, limit past the protective price band, and a reduce-only order or close into a risk bucket that no longer exists.
  • A close that retires an isolated bucket (nothing else resting) returns equityAfter, initialMarginRequiredAfter, maintenanceMarginRequiredAfter, freeCollateralAfter as "0".
  • estimatedLiquidationPrice: isolated = bucket threshold. Cross = conditional on moving only the target position’s mark; other marks, funding, PnL, fees, and collateral shift it. Show absent or blank as unavailable, never 0.

Reduce-Only

reduceOnly: true can only shrink a position, never flip or grow it; a remainder with nothing left to reduce is cancelled. With no position to reduce, a margin reduce-only order is rejected (reduce_only margin orders require an existing position); funding a bucket opens no position. The engine checks the live position, so one sent right after the opening fill is accepted.

Conditional Perps Orders

Take-profit (TP) and stop-loss (SL) legs wait until the mark price crosses triggerPrice, then submit a market or limit close. Long TP and short SL fire when mark rises to or above the trigger; long SL and short TP when it falls to or below. To check a target clears costs, simulate a reduce-only MARKET close of the position’s size: expectedMatchResult.actualSlippageBps is current-book impact (apply it to the trigger, not the mark) and estimatedFee is the close fee (Pre-trade simulation).
  • oco: true makes two legs one-cancels-other (needs both).
  • closePosition: true sizes a leg to the full position at trigger; a fixed quantity never resizes. They are mutually exclusive; quantity is required when closePosition is false, and omitting both means full close.
  • On an entry order (margin, not reduce-only): pass the same takeProfit / stopLoss to placeLimitOrder / placeMarketOrder. Legs wait as pending until it fills, cancel if it is cancelled or expires unfilled, are OCO-linked when both are set, and close in the opposite direction to side. The response has takeProfitOrderId / stopLossOrderId.
Full-close supersede. A position keeps at most one active full-close TP and one full-close SL; the most recently created leg wins. Attaching one atomically cancels the old same-type full-close leg (event reason: "cancelled", then the new "created"), so moving a level is one call. Fixed-quantity legs, the old leg’s OCO sibling, and trailing stops are untouched. Between entry and position legs: a position attach retires an armed entry leg; a still-pending entry leg is left alone but is cancelled instead of armed if its order fills after a newer position attach; an entry order placed later replaces the position’s legs when it fills. Retired legs report “superseded by a newer full-position TP/SL of the same type”. Limits. Defaults: 10 active legs per position, 100 per user per engine shard (pending entry legs included), 100,000 per shard; deployments may override. Position attaches check all three; entry orders check the user and shard limits. Over-limit creates add no legs. Entry orders return 400 / INVALID_ARGUMENT (or a per-item batch error); position attaches return 400 / INVALID_ARGUMENT with the limit in the message. Superseded legs don’t count, so moving a level at the cap works. Cancel unused fixed-quantity legs rather than retrying.

Trailing Stop

A reduce-only market close that fires when the mark retraces trailBps from its best level (watermark) since arming. The trigger only moves in the position’s favour.
  • Long: fires when mark ≤ watermark × (1 − trailBps/10000). Short: when mark ≥ watermark × (1 + trailBps/10000).
  • activationPrice (optional) delays tracking until the mark reaches it and seeds the watermark there; rejected if already reached. Otherwise tracking starts at the current mark.
  • One per position (second returns 409), no modify (cancel and re-attach), coexists with TP/SL, never OCO.
  • On an entry order it arms only on a full fill; otherwise it is cancelled with the order.
Both return trailingStopOrderId; an entry order omits it when a partial fill’s remainder is cancelled (IOC/MARKET). The row has conditionType: "TRAILING_STOP", is PENDING_PARENT until armed, then ACTIVE with trailArmedAt once tracking starts and watermarkPrice next to triggerPrice. conditional_orders emits reason: "armed" when tracking begins and "ratcheted" on each move, with both prices.

Conditional Order Lifecycle

Trigger Price Is Not Fill Price

The trigger uses the mark (a sampled reference price, not the mid); the close fills on the book, possibly after the mark has moved further.
  • A MARKET close pays spread plus depth consumed — usually worse than the trigger, with no guaranteed gap; a fast move can fill better. With nothing fillable inside the 1,200 bps protective band, it is cancelled with a terminalReason.
  • A LIMIT close may rest (SUBMITTED / PARTIALLY_FILLED) or fill partly.
  • Round-trip taker fees apply, so a TP a tick or two from entry can close at a loss.
A TRIGGERED conditional order (getConditionalOrder, listConditionalOrders) carries triggeredOrder — the close’s status, filledQuantity, averageFillPrice, totalTakerFees, filledAt, terminalReason (not on WebSocket frames). Compare prices as decimals, not strings. It can lag getOrder, which has the latest state. The close carries conditionalOrderId in order history; absent on your own orders and older closes (absent there means unknown).
The close then appears on the normal order, trade, position, and balance streams like any order.

Manage Orders

List Orders

GET /api/v1/orders (getPaginatedOrders) lists your LIMIT and MARKET orders, resting and historical, by timestamp. Filter status=SUBMITTED,PARTIALLY_FILLED for the resting set.
  • Not listed: TWAP parents (GET /api/v1/orders/twap, sdk.trading.listTwapOrders), TWAP slices — child orders with parentOrderId, not in total (GET /api/v1/orders/twap/{twapOrderId}/slices, sdk.trading.listTwapOrderSlices), and conditional orders (listConditionalOrders). Parent and conditional lists filter by state and market. Control a TWAP only via its parent (TWAP Orders).
  • A TP/SL close is listed with conditionalOrderId. A LIMIT close can be cancelled but not replaced (INVALID_ORDER).
  • origin: USER, LIQUIDATION, ADL, SYSTEM (also on WebSocket events; absent on TWAP/conditional rows). Use it to label liquidations — a liquidation close looks like a reduce-only IOC limit.
  • placementTakerFeeBps / placementMakerFeeBps: rates fixed at placement, bps decimal strings ("4.5", "-0.1"); a replacement fixes its own. Negative maker = rebate, capped at that fill’s taker fee. Also on WebSocket events and snapshots; absent on some older orders. See Fees.

Cancel Orders

  • A cancel releases locked balance and is final. Cancels run ahead of new orders; fills before the cancel stand.
  • remainingQuantityTarget shrinks in place and keeps queue position (a replace goes to the back); only the released delta unlocks. Retries converge. Must be a positive multiple of the quantity step, below current remaining. Emits non-terminal OrderPartiallyCancelled.
  • batchCancel([...ids]) is best-effort; check each results[i].error. results has one entry per ID you sent, in request order, and totalRequested === totalCancelled + totalFailed. An ID that is not one of your live orders (unknown, another user’s, or already filled or cancelled) fails with ORDER_NOT_FOUND. An order is cancellable as soon as its placement is acknowledged, before it appears in order history. A delegated agent’s batch cancel checks its policy against each order’s stored fields, so an order not yet in history fails with BAD_REQUEST and stays open; retry it shortly.
  • batchCancelAll() / batchCancelAll(pair.id) is capped at 20,000 matching orders; above that it cancels nothing (400). Narrow by pair or batch-cancel ≤100 IDs. Costs one rate-limit item per call. If the exchange refuses the call as OVERLOADED (503), nothing is cancelled and the request fails as a whole; back off and retry. An empty successful response means the sweep ran and found no matching orders.
  • It also withdraws the RFQ quotes you placed through the same application, in RFQs still collecting quotes (on that pair, when given), and rfqQuotesWithdrawn counts them. An RFQ the taker already accepted is left alone: its last look runs, and silence executes. Once the orders are cancelled the call never fails over RFQ quotes: rfqQuotesWithdrawalComplete is false when a quote could not be withdrawn yet or the RFQ service could not be reached, with rfqQuotesWithdrawn counting those withdrawn so far; call it again to withdraw the rest.

Cancel All After

cancelAllAfter(timeoutMs, { tradingPairId }?) is a dead-man switch: if you stop refreshing it, the exchange cancels your resting orders at the deadline. Each call replaces the deadline; refresh well inside the timeout.
  • Order matters. Calls apply in arrival order, so a refresh still in flight when you send 0 re-arms the timer. Await it before disarming.
  • Timeout. 0 disarms; otherwise 5,000–900,000 ms. cancelAt is the stamped deadline, absent after a disarm. A timer that fires is spent; arm again to keep the switch on.
  • Scope. The account-wide timer and each pair timer are independent: arm, refresh and disarm a pair timer with the same tradingPairId. A delegated session must set tradingPairId and hold cancel permission on it.
  • Cancelled: resting limit orders (GTC included), triggered TP/SL legs on the book, non-reduce-only TWAP parents (their resting child ends USER_REQUESTED), and TP/SL or trailing stops still waiting on an unfilled entry order. Cancelled orders carry terminalReason CANCEL_ALL_AFTER. A partly filled entry’s pending legs go with it; the position keeps the legs already armed.
  • Stays: untriggered conditional orders on a position, reduce-only TWAPs.
  • RFQ quotes: Your RFQ quotes are not cancelled by the engine; the RFQ service withdraws the ones standing since before the deadline in RFQs still collecting quotes (on the timer’s pair, when it has one), usually within a second or two of the fire. An RFQ already accepted is left to its last look. See RFQ kill switches.
  • Timing. Due timers are swept every 100 ms, in pages of 1,000 orders; an order placed mid-sweep can be cancelled with it, and a refresh mid-sweep stops the remaining pages. Arming and refreshing work during a maintenance pause, and a timer due then still fires.
  • Errors. 400 / InvalidArgument (timeout out of range, bad or unlisted pair; disarming an armed timer always works), 401, 403 (delegated without pair or permission), 429 (one risk-reduction item per call), 503. OVERLOADED means not applied, so the old deadline stands; any other 503 is unknown. Retrying is safe; the successful response carries the deadline in force.

Replace Orders

Atomically cancels the original and places a new order (new ID, back of queue).
  • Only live orders can be replaced.
  • quantity is the new total (LeavesQty = OrderQty - CumQty): the replacement rests and locks total - filled, so total must exceed filled. A 96/100-filled order replaced with "200" rests 104 (reads 96/200). Omitted, the total is kept and the remainder follows live fills.
  • Reduce-only works the same (0.8 close, 0.3 filled, "0.5" rests 0.2) but may not rest more than the position.
  • The replacement inherits fill history (filled qty, VWAP, fee/payment aggregates); summing across a replace chain double-counts.
  • updatedFields.quantity is the total (omitted: original’s total — a 60/100-filled order reports "100", rests 40); read remainingQuantity for resting size. updatedFields.price is the new or kept price.
  • postOnly and selfTradePreventionMode are per replacement, never inherited (STP falls back to your wallet default).
  • Pending entry TP/SL legs move over, and each fixed trigger must stay on the correct side of the new expected entry (buy: lower of limit and mark; sell: higher), else INVALID_ORDER and the original stays with its legs. Active position legs aren’t re-checked. On an immediate fill, fixed legs arm on any fill and a trailing stop on a full fill; legs stay pending while a remainder rests and are cancelled if it can never fill further.
  • Delegated agents need REPLACE_ORDER and the result must fit the delegation’s pair/margin-account scope, order type, time in force, leverage, and notional. maxOpenOrders is unsupported.
  • A price or quantity off the pair’s tick, minimum, maximum or step rule is a 400 with code INVALID_ORDER and the matching engine’s message; a closed pair answers INVALID_TRADING_PAIR. A price on the grid written with trailing zeros, such as 100.000, is accepted.
  • A rejected replaceOrder (post-only cross included) leaves the original resting, untouched.

Batch Create

  • Items are independent; each failure is a { code, message } on its result.
  • MARKET items must omit timeInForce.
  • Max 100 items (MAX_BATCH_ORDER_ITEMS; SDK and API reject with At most 100 orders per batch request).
  • Each item (reduce-only included) costs one rate-limit item. Over budget, the whole batch gets 429 before any item runs. Raw clients see x-ratelimit-remaining-* headers; the SDK exposes only retryAfter.
  • Per-item keys: Safe Retries.

Batch Replace

Cancel-first: every original is cancelled, in order, before any replacement is placed, so a two-sided quote can cross its own old prices without STP, and replacements can use funds freed by any original. Each success returns a new order ID. Replacements inherit the original’s time in force (always GTC). Max 100 items. A successful item may already be cancelled by STP (CANCEL_TAKER, CANCEL_BOTH, or a SKIP remainder) — check its status. Margin is judged against what each bucket required before the batch. Hitting one of your orders outside the batch goes through STP, not failure. POST_ONLY_WOULD_CROSS still cancels the original if the item crosses a replacement an earlier item rested (an internally crossed ladder), crosses an original that failed to cancel, or its original is listed twice (each judged alone; first occurrence wins). Conversely, if an earlier non-post-only item would have taken the liquidity it was judged against, it is refused with nothing cancelled; retry after the batch. The TypeScript SDK validates the array (BatchReplaceOrdersSchema) first; a bad field (including selfTradePreventionMode) throws ValidationError and nothing is sent. Raw API: all-invalid batches return 2xx with every item failed; only empty or >100-item batches return 400 / InvalidArgument. A 2xx can mix done and failed items. Before retrying, refresh open orders; treat the original as gone unless the failure was validation, and confirm even after POST_ONLY_WOULD_CROSS or a size refusal.

Response Shapes

Error Handling

Branch on the structured code (REST code, gRPC ErrorInfo.reason, batch error.code), not the message. See retryable. Fills limited, not errors: market orders fill only inside the price band (1,000 bps default), cancelling the rest, or are rejected (no liquidity / market unavailable). Taking perp orders stop at the first resting order outside the perp price band; a limit remainder that would still cross is cancelled. In liquidation zero mode, a fill never leaves its risk bucket below zero equity and worse off: takers fill only inside the bankruptcy price (where loss plus fee consume equity) and the rest is cancelled (PRICE_BAND), resting makers that would breach it are cancelled (BANKRUPTCY_PRICE), and nothing is refused at entry. A resting perp order the mark moves past the band is cancelled (PRICE_BAND). Liquidation, ADL, and forced closes are exempt for their own fills only.

Terminal reasons

CANCELLED orders carry terminalReason (REST and WebSocket): USER_REQUESTED, REPLACED, LIQUIDATION, INSUFFICIENT_MARGIN, REDUCE_ONLY_EXHAUSTED, POSITION_CLOSED, OCO_SIBLING_TRIGGERED, SELF_TRADE_PREVENTION, SYSTEM, and:

Order state versions

version is an opaque, compare-only revision of one order’s state: higher is newer, it changes only with state, and getOrder, getPaginatedOrders, order WebSocket events, and the orders snapshot all carry it.
  • Reconnect: keep applying events; merge a REST snapshot per order when snapshot.version >= local.version (never >). Between two REST reads, equal means identical state. On the stream, equal means same step — one step emits several events (OrderPlaced then fills), and a batch create or a batch replace shares one step — so on a tie the snapshot is more complete. Recipe: market-maker runbook.
  • Absent = unknown (older orders), not zero. Gaps are normal. Not comparable across orders.
  • Use version, not updatedAt: detail and list report different clocks for the same order, list time can move without a state change, and precision varies.
Ordinary-order createdAt, updatedAt, expirationDate, all conditional-order times, application order-view createdAt/updatedAt, and TWAP window and lifecycle stamps render at fixed microsecond width with Z (2026-09-05T01:23:45.123456Z). cancelledAt, filledAt, expiredAt, submittedAt, acknowledgedAt, and CreateTwapOrderResponse.firstSliceAt / endTime vary. See also: TypeScript Trades, Orders API, Orderbook API, WebSocket API.