PlaceOrder
Submit a new order to the exchange. Supports limit, market, stop-limit, stop-market, take-profit, stop-loss, and trailing stop orders.
POST
PlaceOrder🔐 AuthCreates a new order on the specified market. The order is signed with your private key and submitted to the blockchain for deterministic execution.
Request
| Parameter | Type | Description |
|---|---|---|
market_idrequired | uint32 | Market ID (0 = RLM-PERP, 1 = RLM-USDC, etc.) |
siderequired | OrderSide | BUY (0) or SELL (1) |
typerequired | OrderType | LIMIT (0), MARKET (1), STOP_LIMIT (2), STOP_MARKET (3), TAKE_PROFIT (4), STOP_LOSS (5), TRAILING_STOP (6) |
priceoptional | int64 | Limit price (8 decimals). Required for LIMIT and STOP_LIMIT orders |
sizerequired | int64 | Order size (8 decimals) |
time_in_forceoptional | TimeInForce | GTC (0), IOC (1), FOK (2), GTD (3)Default: GTC |
reduce_onlyoptional | bool | If true, order can only reduce positionDefault: false |
post_onlyoptional | bool | If true, order must be maker onlyDefault: false |
trigger_priceoptional | int64 | Trigger price for conditional orders (8 decimals) |
trigger_directionoptional | TriggerDirection | ABOVE (0) or BELOW (1) - when to trigger |
trail_percentoptional | int64 | Trail distance as percentage (8 decimals, e.g., 500000000 = 5%) |
expire_timeoptional | uint64 | Expiration timestamp for GTD orders (nanoseconds) |
client_order_idoptional | string | Custom order ID for client tracking |
Response
| Field | Type | Description |
|---|---|---|
success | bool | Whether the order was accepted |
error | string | Error message if success is false |
order_id | uint64 | Unique order identifier |
status | OrderStatus | OPEN, FILLED, PARTIALLY_FILLED, CANCELED |
filled_size | int64 | Amount filled immediately (8 decimals) |
filled_price | int64 | Average fill price (8 decimals) |
timestamp | uint64 | Server timestamp (nanoseconds) |
Example
Request
// Limit orderconst order = await client.placeOrder({market: 'RLM-PERP',side: 'buy',type: 'limit',price: 100.00,size: 1.0,timeInForce: 'GTC',});// Market orderconst marketOrder = await client.placeOrder({market: 'RLM-PERP',side: 'sell',type: 'market',size: 0.5,});// Stop-loss orderconst stopLoss = await client.placeOrder({market: 'RLM-PERP',side: 'sell',type: 'stop_market',size: 1.0,triggerPrice: 90.00,triggerDirection: 'below',reduceOnly: true,});// Trailing stop (5% trail)const trailingStop = await client.placeOrder({market: 'RLM-PERP',side: 'sell',type: 'trailing_stop',size: 1.0,trailPercent: 5.0,reduceOnly: true,});
Response
{"success": true,"orderId": "12345678","status": "OPEN","filledSize": 0,"filledPrice": 0,"timestamp": 1704067200000000000}
Order Types
| Type | Value | Description |
|---|---|---|
LIMIT | 0 | Execute at specified price or better |
MARKET | 1 | Execute immediately at best available price |
STOP_LIMIT | 2 | Limit order that activates when trigger price is hit |
STOP_MARKET | 3 | Market order that activates when trigger price is hit |
TAKE_PROFIT | 4 | Close position at profit target |
STOP_LOSS | 5 | Close position to limit losses |
TRAILING_STOP | 6 | Dynamic stop that follows price movement |
Time in Force
| TIF | Value | Description |
|---|---|---|
GTC | 0 | Good-Till-Cancel: Remains open until filled or canceled |
IOC | 1 | Immediate-Or-Cancel: Fill what you can, cancel rest |
FOK | 2 | Fill-Or-Kill: Complete fill or nothing |
GTD | 3 | Good-Till-Date: Expires at specified time |
Decimal Precision
All prices and sizes use 8 decimal places internally. The SDK handles conversion automatically, but when using the raw API, multiply by 10^8. For example, price 100.50 becomes 10050000000.
Conditional Orders
Stop and trailing stop orders are held by the trigger engine until their conditions are met. They don't appear in GetOpenOrders until triggered — use GetConditionalOrders instead.
Common Errors
| Error | Cause |
|---|---|
INSUFFICIENT_BALANCE | Not enough margin/balance for the order |
INVALID_PRICE | Price is zero, negative, or outside tick size |
INVALID_SIZE | Size is below minimum or above maximum |
POST_ONLY_WOULD_TAKE | Post-only order would execute as taker |
REDUCE_ONLY_WOULD_INCREASE | Reduce-only order would increase position |