Order types
Order options
Each order has one time in force. Fill-or-kill is not supported.
How they work
Market orders are converted to IOC limit orders with a price bound, so they never fill past your slippage limit (10% by default). See Market orders. Stop and take-profit orders wait off the book until they trigger. You choose whether the trigger watches the last trade price or the mark price. You can attach them to a new order or to a position you already hold; when one side triggers, the other is cancelled. A triggered market order uses a fixed 10% slippage limit. See Take-profit and stop-loss. Reduce-only orders larger than your position are rejected. See Reduce-only. No order expires. A GTC order you forget about stays on the book, so cancel what you no longer want.Client order IDs
For API trading. Attach your own ID to every order (client_order_id). You know it the moment you send the order, before the chain assigns its order ID, so you can cancel or modify the order by it.
- Format.
0xfollowed by 32 lowercase hex characters (16 bytes). Uppercase, the wrong length, and all zeros are rejected. The field is optional. - Unique per sub-account among open orders, stops and take-profits included. Reusing the ID of an open order is rejected (
DUPLICATE_CLIENT_ORDER_ID). Each order in a batch needs its own. Once the order closes, the ID can be reused. - Cancel or modify by ID. An unknown ID returns
CLIENT_ORDER_ID_NOT_FOUND. Changing the ID in a modify re-places the order. See Modify orders. - Kept in the record. Filled and cancelled orders keep their ID, so you can match your records to the chain’s.
- Generate IDs randomly, not from a counter. A restart that loses the counter collides with orders still open.
DexOrders.noop() with its nonce; the original is then discarded (NONCE_ALREADY_USED). Once it has landed, cancel it by ID.