Order Types
This reference documents all order-related types in the Trading API, including order types, statuses, and the schemas for submitting and receiving orders.
Enums
OrderType
The type of order determines how and when it executes.
| Value | Description |
|---|---|
MARKET | Execute immediately at the best available price |
LIMIT | Execute at the specified price or better |
STOP | Trigger a market order when price reaches stop_price |
STOP_LIMIT | Trigger a limit order when price reaches stop_price |
TRAILING_STOP | Stop price trails the market by a fixed distance |
OrderStatus
The current state of an order in its lifecycle.
| Value | Description |
|---|---|
PENDING | Order submitted but not yet acknowledged by provider |
PENDING_CANCEL | Cancel request submitted but not yet confirmed by provider |
OPEN | Order is active and waiting to be filled |
PARTIALLY_FILLED | Some quantity has been filled, remainder is still open |
FILLED | Order completely filled |
CANCELLED | Order cancelled (by user or system) |
REJECTED | Order rejected by provider (see reject_reason) |
EXPIRED | Order expired based on time_in_force |
Side
The direction of the order.
| Value | Description |
|---|---|
BUY | Purchase the asset (go long) |
SELL | Sell the asset (go short or close long) |
TimeInForce
How long the order remains active before expiring.
| Value | Description |
|---|---|
GTC | Good Till Cancelled - remains active until filled or cancelled |
DAY | Expires at end of trading day |
IOC | Immediate Or Cancel - fill immediately or cancel unfilled portion |
FOK | Fill Or Kill - fill entire quantity immediately or cancel completely |
RejectReason
Returned on Order.reject_reason when status == REJECTED.
| Value | Description |
|---|---|
INSUFFICIENT_MARGIN | Account has insufficient margin to open the position |
INSUFFICIENT_BALANCE | Account has insufficient free balance for the order |
INVALID_QUANTITY | Quantity is zero, negative, or below the broker's minimum |
INVALID_PRICE | Price is malformed or outside the broker's accepted range |
SYMBOL_NOT_TRADEABLE | Symbol is not tradeable on this broker or account |
MARKET_CLOSED | Market is closed for this symbol |
REDUCE_ONLY_VIOLATED | Order would increase (not reduce) an existing position |
POST_ONLY_VIOLATED | Post-only order would have matched an existing order immediately |
RATE_LIMITED | Broker rejected the order for exceeding rate limits |
UNKNOWN | Broker-specific rejection that does not map to a typed reason |
MarginMode
Margin mode for leveraged trading. Used in OrderRequest.margin_mode and Position.margin_mode.
| Value | Description |
|---|---|
CROSS | Position shares margin with the rest of the account |
ISOLATED | Position has dedicated margin; losses are capped at the isolated allocation |
TrailingType
How trailing_distance is interpreted on TRAILING_STOP orders.
| Value | Description |
|---|---|
ABSOLUTE | Distance is an absolute price offset (e.g., "0.25" USD) |
PERCENT | Distance is a percentage of the reference price (e.g., "1.5" for 1.5%) |
OrderRequest Schema
Submit a new order using the POST /v1/orders endpoint.
Required Fields
| Field | Type | Description |
|---|---|---|
symbol | string | Symbol in canonical format (e.g., "AAPL", "EUR/USD", "BTC/USD") |
side | Side | BUY or SELL |
quantity | string | Order quantity in base units (decimal string) |
order_type | OrderType | Type of order |
Optional Fields
| Field | Type | Description |
|---|---|---|
limit_price | string | Required for LIMIT and STOP_LIMIT orders |
stop_price | string | Required for STOP and STOP_LIMIT orders |
time_in_force | TimeInForce | Default: GTC |
client_order_id | string | Your unique ID for idempotency and tracking |
stop_loss | string | Stop loss price for bracket orders |
take_profit | string | Take profit price for bracket orders |
trailing_distance | string | Distance for TRAILING_STOP orders |
trailing_type | TrailingType | Interpretation of trailing_distance — ABSOLUTE or PERCENT |
reduce_only | boolean | Only reduce existing position, never increase |
post_only | boolean | Reject if order would immediately fill (maker only) |
hidden | boolean | Hide order from order book |
display_quantity | string | Visible quantity for iceberg orders (remainder is hidden) |
oco_group_id | string | Link orders as one-cancels-other |
position_id | string | Target position ID on hedging accounts |
leverage | string | Leverage multiplier (decimal string, e.g., "5") |
margin_mode | MarginMode | Margin mode for leveraged positions — CROSS or ISOLATED |
Examples
Market Order
{
"symbol": "AAPL",
"side": "BUY",
"quantity": "100",
"order_type": "MARKET"
}
Limit Order with Stop Loss
{
"symbol": "EUR/USD",
"side": "BUY",
"quantity": "10000",
"order_type": "LIMIT",
"limit_price": "1.0850",
"time_in_force": "GTC",
"stop_loss": "1.0800",
"take_profit": "1.0950"
}
Stop Limit Order
{
"symbol": "BTC/USD",
"side": "SELL",
"quantity": "0.5",
"order_type": "STOP_LIMIT",
"stop_price": "40000",
"limit_price": "39950",
"reduce_only": true
}
Order Response Schema
Orders returned from GET /v1/orders or via WebSocket events.
Fields
| Field | Type | Description |
|---|---|---|
id | string | Server-assigned order ID |
symbol | string | Trading symbol |
side | Side | Order side |
order_type | OrderType | Order type |
quantity | string | Original order quantity |
filled_quantity | string | Quantity filled so far |
remaining_quantity | string | Quantity remaining to fill |
average_fill_price | string? | Weighted average fill price (null if unfilled) |
status | OrderStatus | Current order status |
time_in_force | TimeInForce | Time in force |
limit_price | string? | Limit price (for LIMIT orders) |
stop_price | string? | Stop price (for STOP orders) |
stop_loss | string? | Stop loss price |
take_profit | string? | Take profit price |
client_order_id | string? | Client-provided order ID |
correlation_id | string? | Gateway-assigned correlation ID for tracing the order through its lifecycle |
reject_reason | RejectReason? | Rejection reason if status is REJECTED |
trailing_distance | string? | Trailing distance for TRAILING_STOP orders |
trailing_type | TrailingType? | Interpretation of trailing_distance — ABSOLUTE or PERCENT |
display_quantity | string? | Visible quantity for iceberg orders |
oco_group_id | string? | OCO group ID if this order is part of a one-cancels-other pair |
position_id | string? | Associated position ID on hedging accounts |
reduce_only | boolean? | Whether this is a reduce-only order |
post_only | boolean? | Whether this is a post-only (maker-only) order |
hidden | boolean? | Whether this is a hidden order |
created_at | datetime | When the order was created |
updated_at | datetime | When the order was last updated |
Example Response
{
"id": "ord_abc123",
"symbol": "AAPL",
"side": "BUY",
"order_type": "LIMIT",
"quantity": "100",
"filled_quantity": "60",
"remaining_quantity": "40",
"average_fill_price": "150.25",
"status": "PARTIALLY_FILLED",
"time_in_force": "GTC",
"limit_price": "150.50",
"client_order_id": "my-order-001",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:05Z"
}
Related Types
- Position Types - Track your holdings
- Event Types - Handle order update events