Skip to main content

Place Order

Description​

Place an order.

Take-profit and stop-loss instructions attached to an order (takeProfit / stopLoss)

  • For linear futures, 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 takeProfit creates or updates the full-position take-profit and cancels any untriggered full-position stop-loss that can be canceled. Supplying only stopLoss creates 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​

FieldTypeRequiredDescription
categorystringYesProduct type: spot / linear
symbolstringYesTrading pair, e.g., BTCUSDT (linear), btc_usdt (spot)
sidestringYesDirection: BUY / SELL
orderTypestringYesorder type: Market / Limit
qtystringYesOrder quantity. For a spot Market Buy, specify the amount in the quote asset.
pricestringNoLimit order price.
timeInForcestringNoAccepted 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.
positionIdxint64NoFutures position mode: 0 one-way, 1 long, 2 short. Accounts in one-way mode can omit it. The default is 0.
orderLinkIdstringNoCustom order ID, currently 36 characters long, including letters, digits, and punctuation, uniquely identified from the user's perspective
triggerPricestringNoTrigger price for conditional order
triggerDirectionint32NoTrigger direction: triggered when 1 price increases / triggered when 2 price decreases
triggerBystringNoTrigger price type: LastPrice / MarkPrice
takeProfitstringNoTake-profit trigger price, take-profit type is market order
stopLossstringNoStop-loss trigger price, stop-loss type is market order
tpTriggerBystringNoTake-profit trigger price type. For contracts, default is LastPrice, LastPrice / MarkPrice.
slTriggerBystringNoTake-profit trigger price type. For contracts, default is LastPrice, LastPrice / MarkPrice.
reduceOnlyboolNoWhether to reduce only; reduceOnly only applies to linear contracts, having a reduce-only effect

Response Parameters​

FieldTypeDescription
orderIdstringSystem order ID
orderLinkIdstringCustom 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
}