Create Order
Create a futures opening or closing order, supporting market and limit orders.
API Information
- Method:
POST - Path:
/api/v1/futures/open-api/order/create
Margin Mode
The create order endpoint does not accept a marginMode parameter. The server uses the current account configuration for the trading pair: 1=Cross, 2=Isolated.
- Query current mode: Account Contract Config —
GET /account/config?symbol=...→data.marginMode - Switch mode: Update Margin Mode —
POST /account/margin-mode(or set together via Update Leverage)
Isolated margin workflow:
1. GET /account/config?symbol=BTCUSDT → confirm current marginMode
2. POST /account/margin-mode { symbol, marginMode: 2 } → switch if needed
3. POST /order/create { ... } → no marginMode required
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Futures trading pair, e.g. BTCUSDT |
| coType | int | Yes | Contract type: 1=US stocks, 2=Hong Kong stocks, 3=Cryptocurrency |
| orderType | int | Yes | Order type: 1=Limit, 2=Market |
| openType | int | Yes | Open/Close: 1=Open, 2=Close |
| side | int | Yes | Direction: 1=Long (Buy), 2=Short (Sell) |
| price | string | Conditional | Order price (required for limit orders) |
| vol | string | Conditional | Quantity (choose vol or amt) |
| amt | string | Conditional | Amount in USD (choose vol or amt, recommended for opening) |
| leverage | string | Required for open | Leverage, e.g. "10" |
| posId | int64 | Required for close | Position ID |
| stopProfitPrice | string | No | Take profit price |
| stopLossPrice | string | No | Stop loss price |
| triggerType | int | No | Trigger type: 1=Normal, 2=Take profit, 3=Stop loss, 4=Liquidation |
Request Example
Opening Example:
{
"symbol": "BTCUSDT",
"coType": 3,
"orderType": 2,
"openType": 1,
"side": 1,
"amt": "10000",
"leverage": "10",
"triggerType": 1
}
Closing Example:
{
"symbol": "BTCUSDT",
"coType": 3,
"orderType": 2,
"openType": 2,
"side": 1,
"posId": 123456,
"vol": "0.5",
"triggerType": 1
}
Response Fields
| Field | Type | Description |
|---|---|---|
| code | int | Status code, 0 indicates success |
| msg | string | Response message |
| data.orderId | int64 | Order ID |
| data.orderNo | string | Order number |
Response Example
{
"code": 0,
"msg": "success",
"data": {
"orderId": 123456789,
"orderNo": "ORD20240120001"
}
}
Error Codes
Business errors are returned with HTTP 200. Use the body code field to identify the specific error.
| code | Description |
|---|---|
| 3000 | Trading pair not found |
| 8001 | Below minimum trade amount |
| 8002 | Close position order failed, please check your position |
| 8003 | Insufficient balance to close, please check position and open orders |
| 8004 | Order creation failed |
| 8005 | Take-profit/stop-loss order creation failed |
| 8006 | Take-profit/stop-loss order would be triggered immediately |
| 8016 | Exceeds maximum trade amount |
| 8017 | Exceeds maximum position size |
| 8018 | Insufficient margin |
| 8100 | Product information error |