Skip to main content

Matrix

MARKET + GTC is semantically nonsensical — the order is not placed: the response is HTTP 201 with status: "REJECTED" and code: "invalid_tif". timeInForce defaults to gtc for every order type, so a market order must send ioc or fok.
GTD is not a separate enum value. The request schema accepts timeInForce: 'gtc' | 'ioc' | 'fok' only. Sending "timeInForce": "gtd" is rejected at request validation with 400 invalid_request (timeInForce must be one of the following values: gtc, ioc, fok). To place a Good-Til-Date order, submit timeInForce: "gtc" with a non-zero expiry timestamp.

GTC — Good Till Cancelled

Default for LIMIT orders (type: "limit", timeInForce: "gtc", expiry: 0). Rests on the book indefinitely until:
  • cancelled by the user (POST /api/orders/cancel, /cancel-batch, or /cancel-all),
  • cancelled by self-trade prevention, when an aggressive market order from the same wallet comes to it,
  • filled by counterparty orders,
  • the market closes or resolves (cancelled by the platform with CANCELLED).

GTD — Good Till Date (via GTC + Expiration)

To place an order that rests on the book but automatically expires at a future cutoff:
  1. Set timeInForce: "gtc" (or omit timeInForce, which defaults to "gtc").
  2. Set expiry in the request body to the desired Unix timestamp (in seconds), which signs as Order.expiration in the EIP-712 struct.

Expiration safety threshold (order_expiry_too_soon)

Settlement is asynchronous: off-chain matches are batched and broadcast to CTFExchange by match-submitter. Because an on-chain submission can take tens of seconds during high chain load, an order that expires before the transaction mines would cause the entire batch match to revert with MatchFailed(OrderExpired). To protect against this:
  • On POST /api/orders/place and POST /api/orders/place-batch, any non-zero expiry must be more than 60 seconds after current server time (a 30-second ORDER_EXPIRY_SAFETY_SECONDS pre-broadcast settlement buffer plus a 30-second gateway placement margin).
  • An order with 0 < expiry <= now + 60s is refused with HTTP 400 code: order_expiry_too_soon. The error response carries error.details.minExpiration indicating the earliest acceptable Unix timestamp.
  • On POST /api/orders/place-batch, a near-expiry entry is rejected in its own slot with { success: false, status: "REJECTED", code: "order_expiry_too_soon", details: { minExpiration, ... } }, while valid sibling orders in the batch proceed normally.
  • If an order’s signed expiry has already elapsed when it arrives and the signature is valid for your wallet, it is also refused with 400 order_expiry_too_soon (rather than bad_signature).

Expiry lifecycle and pastDeadline

When an open or partially filled GTD order reaches its expiration timestamp:
  • The matching engine releases the order and stops matching it.
  • Before platform cleanup sweeps the order row, read endpoints (GET /api/orders/open, GET /api/orders/history, GET /api/orders/{id}) return the order with an additive flag: pastDeadline: true.
  • The background reconciler janitor updates the order to its terminal state status: "EXPIRED" and releases all locked collateral back to available.

IOC — Immediate Or Cancel

Executes whatever is immediately available at the requested price; the unfilled remainder is cancelled, not rested. A LIMIT + IOC order whose price reaches one of your own resting orders is REJECTED with code: self_cross_blocked and takes nothing, even from better-priced orders of other participants (see Self-trade prevention).

FOK — Fill Or Kill

All-or-nothing. If the full quantity isn’t immediately available at the price, nothing fills and status is CANCELLED. A LIMIT + FOK order whose price reaches one of your own resting orders is not cancelled but REJECTED with code: self_cross_blocked (see Self-trade prevention).

MARKET orders

MARKET + IOC — sweep the book starting from the best price until quantity is exhausted or the price slippage cap is hit. MARKET + FOK — all-or-nothing within the price slippage cap. If the book cannot fill the full quantity at or better than price, nothing fills and the order ends CANCELLED with no trades. Otherwise it fills completely, sweeping the book like MARKET + IOC. Your own resting orders do not count toward the full quantity. A FOK order (LIMIT or MARKET) whose fill would need more than 512 entries in one answer (fills, self-trade cancels and expired makers together) is also cancelled with nothing filled. When a market order’s sweep comes to one of your own resting orders, it cancels that order (reason: "self_trade_prevention") and keeps filling against other participants’ orders. See Self-trade prevention.

Post-only orders (postOnly: true)

Post-only guarantees that an order only enters the book as a maker quote and never takes liquidity:
  • Eligible orders: postOnly: true is strictly permitted only for LIMIT orders with GTC time-in-force.
  • Invalid combinations: Pairing postOnly: true with type: 'market' or with timeInForce: 'ioc' / 'fok' is rejected with code: post_only_invalid_order_type. On POST /api/orders/place this is an immediate HTTP 400; on POST /api/orders/place-batch it returns HTTP 201 with an entry-level rejection { success: false, status: "REJECTED", code: "post_only_invalid_order_type" }.
  • Crossing protection: In continuous matching, if a post-only order’s price crosses or touches the opposite side of the book, it is rejected with { status: "REJECTED", code: "post_only_would_cross" } without executing.

Which to pick

All supported combinations are accepted by POST /api/orders/place and POST /api/orders/place-batch: pass type + timeInForce in the body. Both fields are optional; defaults are limit + gtc.