Place Order
Description
Place an order.
Take-profit and stop-loss instructions attached to an order (takeProfit / stopLoss)
- For
linearfutures, an opening order can carry a take-profit or stop-loss trigger price. When the opening order fills, the system creates or updates the corresponding conditional order. A partial fill is enough. Unfilled orders and untriggered opening conditional orders generate no take-profit or stop-loss orders. The setting applies to the entire position on that side, including the existing position. Quantity adjusts as the position changes. The trigger closes the position at market price. - For futures, supplying only
takeProfitcreates or updates the full-position take-profit and cancels any untriggered full-position stop-loss that can be canceled. Supplying onlystopLosscreates or updates the full-position stop-loss and cancels any untriggered full-position take-profit that can be canceled. Omit both fields to open a position without attaching new take-profit or stop-loss settings.
HTTP Request
- POST
/api/v3/order/create - Supported Products:
spot/linear - Rate Limit: 10 requests per second per UID
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
category | string | Yes | Product type: spot / linear |
symbol | string | Yes | Trading pair, e.g., BTCUSDT (linear), btc_usdt (spot) |
side | string | Yes | Direction: BUY / SELL |
orderType | string | Yes | order type: Market / Limit |
qty | string | Yes | Order quantity. For a spot Market Buy, specify the amount in the quote asset. |
price | string | No | Limit order price. |
timeInForce | string | No | Accepted values are GTC, IOC, FOK, and PostOnly. This field is optional for spot and futures. Limit orders default to GTC, which remains active until canceled. Market orders default to IOC, which executes immediately and cancels any unfilled quantity. |
positionIdx | int64 | No | Futures position mode: 0 one-way, 1 long, 2 short. Accounts in one-way mode can omit it. The default is 0. |
orderLinkId | string | No | Custom order ID, currently 36 characters long, including letters, digits, and punctuation, uniquely identified from the user's perspective |
triggerPrice | string | No | Trigger price for conditional order |
triggerDirection | int32 | No | Trigger direction: triggered when 1 price increases / triggered when 2 price decreases |
triggerBy | string | No | Trigger price type: LastPrice / MarkPrice |
takeProfit | string | No | Take-profit trigger price, take-profit type is market order |
stopLoss | string | No | Stop-loss trigger price, stop-loss type is market order |
tpTriggerBy | string | No | Take-profit trigger price type. For contracts, default is LastPrice, LastPrice / MarkPrice. |
slTriggerBy | string | No | Take-profit trigger price type. For contracts, default is LastPrice, LastPrice / MarkPrice. |
reduceOnly | bool | No | Whether to reduce only; reduceOnly only applies to linear contracts, having a reduce-only effect |
Response Parameters
| Field | Type | Description |
|---|---|---|
orderId | string | System order ID |
orderLinkId | string | Custom Order ID |
Request Example
POST /api/v3/order/create HTTP/1.1
Host: openapi.lbank.com
Content-Type: application/json
ex-api-key: <your_api_key>
ex-timestamp: <current_unix_timestamp_ns>
ex-nonce: <unique_random_hex>
ex-signature: <your_signature>
ex-client-type: API
{
"category": "linear",
"symbol": "BTCUSDT",
"side": "BUY",
"orderType": "Limit",
"qty": "0.001",
"price": "60000",
"timeInForce": "GTC",
"positionIdx": 0,
"orderLinkId": "b320fe1a-478c-4d2e-a219-000000000002",
"reduceOnly": false
}
The examples below use the request headers for POST /api/v3/order/create shown above and show only the JSON bodies. Futures examples use one-way mode. Adjust quantities and prices to your account mode, market conditions, and trading pair rules. When supplying orderLinkId, use a new ID for each order.
Spot limit buy
qty is the quantity in the base asset. This example buys 0.001 BTC at a limit price of 60000 USDT.
{
"category": "spot",
"symbol": "btc_usdt",
"side": "BUY",
"orderType": "Limit",
"qty": "0.001",
"price": "60000",
"timeInForce": "GTC"
}
Spot market buy
qty represents the amount in the settlement coin. For example, placing an order for 100 USDT. A market order omits price and is executed via IOC.
{
"category": "spot",
"symbol": "btc_usdt",
"side": "BUY",
"orderType": "Market",
"qty": "100"
}
Limit order to open long with take-profit and stop-loss
The opening limit price is 60000. The mark price triggers both take-profit and stop-loss. After an opening fill, the system sets take-profit and stop-loss for the corresponding position.
{
"category": "linear",
"symbol": "BTCUSDT",
"side": "BUY",
"orderType": "Limit",
"qty": "0.001",
"price": "60000",
"timeInForce": "GTC",
"positionIdx": 0,
"takeProfit": "65000",
"stopLoss": "55000",
"tpTriggerBy": "MarkPrice",
"slTriggerBy": "MarkPrice"
}
Futures market order to go long, with only stop-loss attached
This example assumes a mark price of about 60000. qty is the futures order quantity. Market orders omit price. If you supply only a stop-loss, the opening fill cancels any existing full-position take-profit that is still cancelable.
{
"category": "linear",
"symbol": "BTCUSDT",
"side": "BUY",
"orderType": "Market",
"qty": "0.001",
"positionIdx": 0,
"stopLoss": "55000",
"slTriggerBy": "MarkPrice"
}
Trigger market buy on futures contract price increase
Example: assume the mark price is currently below 62000. triggerDirection: 1 indicates a trigger in the upward direction. Once the mark price rises to 62000, a market buy order is submitted;
{
"category": "linear",
"symbol": "BTCUSDT",
"side": "BUY",
"orderType": "Market",
"qty": "0.001",
"positionIdx": 0,
"triggerPrice": "62000",
"triggerDirection": 1,
"triggerBy": "MarkPrice"
}
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"code": 200,
"message": "Success",
"data": {
"orderId": "example_order_id",
"orderLinkId": "b320fe1a-478c-4d2e-a219-000000000002"
},
"extras": null
}