Order types
Tplus supports limit and market orders. Time-in-force for limit orders:
Rules:
- All orders expire 30 days after creation, regardless of time-in-force.
- Market orders never rest on the book. Quantity is specified either in base-asset units or in quote/USD terms. Base-sized market buys can carry an optional quote cap; quote-sized market sells can carry an optional base cap.
- Post-only orders rest without executing. If your order crosses only your own resting orders, it cancels them and rests. If it crosses another signer’s order, it is rejected and all opposite orders stay.
- Reduce-only orders are rejected if they would increase or flip the position. The OMS pre-checks IOC and market orders with a base quantity; the clearing engine enforces the constraint on every order.
- A margin order that would grow a position is rejected when it does not fit the room left under the market’s total open interest cap:
TOTAL_OI_LONG_CAP_REACHEDfor a buy,TOTAL_OI_SHORT_CAP_REACHEDfor a sell. The room on a side is the cap, valued at the higher of the mark and oracle price, minus the open interest already on that side. Your position is counted against your margin orders on that side nearest to the market first, so a new order nearer the market than a resting one takes the position that order was reducing: the resting order then counts as growing a position, and the new order is rejected if that no longer fits. An order is never rejected for quantity that only reduces your position, reduce-only orders are not checked, and spot orders are not affected. When the room shrinks, resting margin orders that would grow a position are reduced to fit, farthest from the market first, and canceled when no room is left; they are not restored when room returns. - The same applies under the market’s spot OI cap:
SPOT_OI_LONG_CAP_REACHEDfor a buy,SPOT_OI_SHORT_CAP_REACHEDfor a sell. The room for buys is the cap minus the market’s net margin exposure, and the room for sells is the cap plus it. Orders that only reduce your position are never rejected or reduced by this rule, and spot orders only in one case: on a market whose spot OI cap is set to 0 while its total OI cap is positive, spot buys are rejected withSPOT_OI_LONG_CAP_REACHEDand resting ones are canceled; spot sells still trade. Margin orders are accepted against the total OI cap alone, but the spot OI cap still applies when they fill: an order that opens a position fills against a margin order opening the opposite position, and is rolled back if it matches a spot sell. - An order is rejected when the price state of the market’s asset does not allow it, with
MARKET_WARMING_UP,MARKET_DEGRADEDorMARKET_CIRCUIT_BREAKER, each a503withretryable: true. While the asset is warming up, only post-only orders are accepted. While it is degraded, a margin order must reduce a position with all of its open quantity, counted with your other open orders on that side, and a trading account with a liability may only sell spot it holds. While it is in circuit breaker, no order is accepted. Designated market maker (DMM) quotes are held to the same rules. When the asset turns degraded or enters circuit breaker, resting orders are cut to what the new state allows, and removed when it allows none of them. - Order limits, which apply to every account, market makers included:
- An order that can rest on the book (GTC or GTD, post-only or not, reduce-only included) must be worth at least 5 units of the quote asset (
limit_price × quantity), or it is rejected withORDER_BELOW_MINIMUM_SIZE. IOC, fill-or-kill and market orders and trigger orders have no minimum. A replace or amend that would leave less than 5 units of quote unfilled is rejected too, and the order stays as it was. An order that falls under the minimum by being partly filled keeps resting, but if the OMS has to reduce it below the minimum it cancels it instead. - A sub-account may hold at most 200 open orders per market: resting orders, trigger orders without a parent order, and trigger orders that have fired and rest. The next one is rejected with
OPEN_ORDER_LIMIT_REACHEDuntil one ends. IOC and market orders, and take-profit or stop-loss orders attached to a parent, are not counted and can still be placed. An attached order counts once it fires, so it can take a sub-account past 200; only new orders are refused. Attached orders that have not fired are limited separately: a sub-account may hold at most 1000 orders per market in total, attached ones included, and past that every new order that would stay in the book is rejected withOPEN_ORDER_LIMIT_REACHED. IOC and market orders can still be placed. - A parent order may have at most 5 take-profit or stop-loss orders attached and waiting at once; the next is rejected with
CHILD_ORDER_LIMIT_REACHED. An attached order must be placed from the parent’s own sub-account. One that fires, is canceled or expires frees its place.
- An order that can rest on the book (GTC or GTD, post-only or not, reduce-only included) must be worth at least 5 units of the quote asset (
- Fill-or-kill checks that at least one completion dimension can be satisfied before matching or cancels. For capped market orders, either the target quantity/amount or the protective cap can be the completion dimension. The all-or-nothing guarantee holds through finalization (see order lifecycle).
- Self-trade prevention covers every sub-account of the same signer. When your incoming order reaches one of your resting orders, the resting order is canceled with reason
SelfTradePreventedand matching continues against other liquidity.
10,000 USD and matches at a 2,500 USD VWAP, so base_filled = 10,000 USD / 2,500 USD = 4 ETH. A base-sized market buy for 4 ETH with a 9,500 USD quote cap would stop at 3.8 ETH at the same VWAP.
Trigger orders
Trigger orders rest in a separate trigger book and move to the orderbook when a finalized trade price crosses the trigger price.PriceAbove: releases when the price rises to the trigger (take-profit).PriceBelow: releases when the price falls to the trigger (stop-loss).
Closing a position
A margin position has two legs (see margin positions), so closing it takes two steps:- Flatten the asset exposure. Place an order on the opposite side - sell to close a long, buy to close a short - sized to the position. A market order flattens immediately; a limit or trigger order (stop-loss / take-profit) flattens at a price. There is no dedicated close order type and no auto-sizing: you submit the quantity. The reduce-only flag guarantees the order can only shrink the position - it is rejected if it would flip or increase exposure.
- Clear the position. Flattening the asset to zero does not remove the position; it lingers as a flat position holding its realized PnL in the quote (USD) leg.
POST /account/transfer/clear-positionclears it: it folds that quote into the sub-account’s spot balance and removes the position. While a long is open, it moves only a quote profit to spot and the long stays; any other open position is rejected (No settled PnL while the long is openorNo settled PnL while the short is open), so flatten first. The freed spot balance can then be transferred or withdrawn. If the quote balance is negative the user must have sufficient USD in their account to offset the negative balance.
GET /positions/close-all/{user_id}/{sub_account} returns unsigned suggested close orders for open positions in that sub-account. It is a preview: sign each returned order, submit the signed orders with POST /orders/batch-create, then clear each position.
Order fields
Orders can carry additional co-signers, validated against the account multisig configuration.
Managing orders
- Replace updates price, quantity, or trigger on a resting limit order atomically. It requires a new signature and passes a fresh margin check. Fill state of a partially-filled order is preserved.
- Cancel over REST returns
ORDER_NOT_FOUNDif the OMS cannot find the target order for that user, asset, and order ID; REST does not hold absent orders for later arrival. The order-control channel forwards cancels directly to the orderbook, where a cancel that reaches the fast queue before its create can be held and used to reject the later create. - Batch create accepts up to 50 orders per request and returns per-order statuses.
- Batch replace (
PATCH /orders/batch-replace, orBatchReplaceRequeston the order-control channel) accepts up to 50 signed replaces in one request and returns one result per item, in submission order. Each item is authorized, looked up and margin-checked exactly like a single replace, so a failing item is rejected on its own (OrderNotFound,InsufficientMargin, …) while the rest proceed. The items that pass are grouped by market and sent to each orderbook as one message, with the markets dispatched concurrently, and each orderbook answers with one response carrying every item’s verdict, so refreshing many quotes costs one round-trip per market. A batch of more than 50 items, or one naming the same order ID more than once, is rejected wholesale before any item is processed. On the control channel the batch is acknowledged once withsubmittedand then streams oneReplaceOrderResponseper item as each orderbook replies. Rate-limit cost is 1.5 units per item, rounded up. - Batch amend (
PATCH /orders/batch-amend, orBatchAmendRequeston the order-control channel) lowers the quantity of up to 50 resting orders in one request and returns one result per item, in submission order. LikePATCH /orders/amend, an amend carries no new signature or price and can only reduce the quantity. Each item is authorized and validated exactly like a single amend, so a failing item is rejected on its own (AmendWouldIncreaseQuantity,StaleAuthorizationRevision, …) while the rest proceed. The items that pass are grouped by market and sent to each orderbook as one message, with the markets dispatched concurrently, and the orderbook answers each item on its own, so shrinking many quotes costs one round-trip per market. A batch of more than 50 items, or one naming the same order ID more than once, is rejected wholesale before any item is processed. On the control channel the batch is acknowledged once withsubmittedand then streams oneAmendOrderResponseper item as each orderbook replies. Rate-limit cost is 1.5 units per item, rounded up. - Cancel-all (all markets or one market, optional
max_tscutoff) and cancel-batch (by ID) return202on acceptance: dispatched, not done. Confirm via the orders WebSocket stream or a follow-up query. IDs not owned by the caller are silently excluded.
Advanced edge cases
Order states
A queried order reports one of these states:
An order queried on the OMS also reports
removal_reason: why it left the book. It is the reason of the order’s Removed event on the orders stream, spelled the same way:
removal_reason is null until the OMS has applied that event: while the order is live, for an order already reported as canceled whose Removed event has not arrived yet, and for an order that ended without one (an order the orderbook refused at creation, for example). The state and removal_reason are reported independently of each other: the reason never changes the state.
Order history on the market data service carries the same removal_reason. It follows the OMS with a short delay, and is also null for an order that ended before the field was added.
A resting order’s reported filled quantity includes an optimistic component from fills that are not yet finalized and can be reverted; the finalized filled quantity counts only finalized fills.
Validation
Checks run in this order:- OMS: authenticated and per-user rate limits, signer identity, order ID rules, reduce-only pre-check.
- OMS: preflight - trading capacity including the order pressure of existing open orders, at both oracle and mark price, taking the worse. Failures return
InsufficientInventoryorInsufficientMargin. An order the asset’s price state does not allow is rejected here too, withMarketWarmingUp,MarketDegradedorMarketCircuitBreaker. See Margin. - Clearing Engine: signature, overfill, order parameters, risk controls, reduce-only, post-trade IM. Failures here arrive as match reverts (status
Rollbacked) on the trade-event stream. Fills that reach the clearing engine more than 5 minutes after matching are reverted as stale matches.
CounterpartyAtFault.
Auto-reduce
If price moves make an account’s trading capacity negative, the OMS reduces or cancels its open orders automatically, farthest-from-market first, with a per-sub-account cooldown. IOC/FOK and in-flight orders are never auto-reduced. Server-initiated reductions appear on the orders WebSocket stream. A designated market maker’s (DMM) post-only orders on a market whose base asset is a native asset are not reduced for trading capacity or spot balance; its other orders are reduced as anyone’s. While a venue’s margin call on an account is in its grace period, the account is held to reduce-only: new orders that add risk are refused withInsufficientMargin, and resting ones are cut to what reduces a position.
For normal limit orders in the same market, farthest-from-market means the largest percentage distance from the current market reference:
100 USD reference price, normal open buys at 80 USD and 95 USD are 20% and 5% away, so the 80 USD order is reduced first. Trigger orders are prioritized by their trigger-side semantics rather than this simplified normal-order example.
Reading orders and trades
REST reads are paginated (zero-basedpage plus limit): orders per user, or per user and market, with an open_only filter; authenticated market-data REST trade history can include confirmed, finalized and rolled-back trades. The lookup by client order ID (GET /orders/lookup, optionally restricted to one market with asset_id) returns the order holding that ID now, or 404 when you hold none; GET /orders/lookup/all returns every order you hold under the ID, live and recently ended, sorted by market with the order holding the ID now last within each market, and an empty list when you hold none. Reads span all of the caller’s sub-accounts. Check each trade’s status, or follow the WebSocket streams for updates.