Orders API
The Orders API provides order entry and management capabilities for trading on markets.Endpoints
Order Entry
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/orders | Create a new order |
POST | /v1/order/preview | Preview order before submission |
Order Query
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/orders/open | Get all open orders |
GET | /v1/order/{orderId} | Get a specific order by ID |
Order Cancellation
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/order/{orderId}/cancel | Cancel a specific order |
POST | /v1/orders/open/cancel | Cancel all open orders |
Order Types
| Type | Description |
|---|---|
ORDER_TYPE_LIMIT | Limit order at specified price |
ORDER_TYPE_MARKET | Market order executed at best available price |
Order Intent
Orders require an intent indicating position direction:| Intent | Description |
|---|---|
ORDER_INTENT_BUY_LONG | Buy to open or increase a long position |
ORDER_INTENT_SELL_LONG | Sell to close or reduce a long position |
ORDER_INTENT_BUY_SHORT | Buy to close or reduce a short position |
ORDER_INTENT_SELL_SHORT | Sell to open or increase a short position |
Order States
Orders progress through these states:| State | Description |
|---|---|
ORDER_STATE_PENDING_NEW | Order received, not yet processed |
ORDER_STATE_PARTIALLY_FILLED | Order partially executed |
ORDER_STATE_FILLED | Order fully executed |
ORDER_STATE_CANCELED | Order canceled by user |
ORDER_STATE_REJECTED | Order rejected by exchange |
ORDER_STATE_EXPIRED | Order expired (GTD orders) |
Time in Force
| TIF | Description |
|---|---|
TIME_IN_FORCE_GOOD_TILL_CANCEL | Good till canceled |
TIME_IN_FORCE_GOOD_TILL_DATE | Good till specified date |
TIME_IN_FORCE_IMMEDIATE_OR_CANCEL | Immediate or cancel |
TIME_IN_FORCE_FILL_OR_KILL | Fill completely or cancel |
Best Practices
- Use WebSocket for updates - Subscribe to order updates instead of polling
- Preview before submit - Use the preview endpoint for order validation
- Handle rejects - Implement proper error handling for rejected orders
- Use synchronous execution - Set
synchronousExecution: trueto wait for order acknowledgment