Skip to main content

Place Order

info
  • Market order: A traditional market order, which will be filled at the current optimal price. Only when the market order selected, the price could be null. To protect the market order from serious slippage, Bybit will convert the market order into a limit order with the buy order price higher than the optimal selling price, and the sell order price lower than the optimal buying price. Both the limit price and the executed price can be queried through the user's transaction history interface.

  • Limit order: You can set an executed price for your order. When the market price touches the price you set, the system will fill the order for you.

  • Take profit / Stop loss: You can set TP/SL while placing orders. Besides, you could modify the position's TP/SL.

  • Order quantity: The quantity of perpetual contracts you are going to buy/sell. For the order quantity, Bybit only supports positive number at present.

  • Order price: Place a limit order, this parameter is required. If you don't have position, the long order price should be higher than 10% of the market price and lower than 1 million. If you have position, the price should be higher than the liquidation price. For the minimum unit of the price change, please refer to the priceFilter field in the instrumentInfo.

  • orderLinkId: You can customize the active order ID. We can link this ID to the order ID in the system. Once the active order is successfully created, we will send the unique order ID in the system to you. Then, you can use this order ID to cancel active orders. Meanwhile, your customized order ID should be no longer than 36 characters and should be unique.

  • Each account can hold a maximum of 500 active orders simultaneously. This is contract-specific, so the following situation is allowed: The same account can hold 300 BTCUSD active orders and 280 ETHUSD active orders at the same time. When the upper limit of orders is reached, you can still place orders with parameters of reduceOnly or closeOnTrigger.

HTTP Request

POST /unified/v3/private/order/create

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type. linear, option
symboltruestringSymbol name
sidetruestringBuy, Sell
orderTypetruestringMarket, Limit
qtytruestringOrder quantity
pricefalsestringOrder price. Invalid if orderType=Market
basePricefalsestring
  • Used to compare with triggerPrice, to decide whether your conditional order will be triggered by crossing trigger price from upper side or lower side.
  • Mainly used to identify the expected direction of the current conditional order.
triggerPricefalsestringIf you expect the price to rise to trigger your conditional order, make sure:
triggerPrice > max(market price, basePrice)
Else, triggerPrice < min(market price, basePrice)
triggerByfalsestringTrigger price type. LastPrice, IndexPrice, MarkPrice
orderIvfalsestringImplied volatility. option only. Pass the real value, e.g for 10%, 0.1 should be passed
timeInForcetruestringTime in force. GoodTillCancel, ImmediateOrCancel, FillOrKill, PostOnly
positionIdxfalseintegerPosition mode. 0: one-way mode.
orderLinkIdfalsestringUser customised order id. A max of 36 characters. Combinations of numbers, letters (upper and lower cases), dashes, and underscores are supported.
rule of future:
  • optional param
  • The same orderLinkId can be used for both USDC PERP and USDT PERP.
  • An orderLinkId can be reused once the original order is either Filled or Cancelled
  • rule of option:
  • required param
  • always unique
takeProfitfalsestringTake profit price
stopLossfalsestringStop loss price
tpTriggerByfalsestringThe price type to trigger take profit. MarkPrice, IndexPrice, default:LastPrice
slTriggerByfalsestringThe price type to trigger stop loss. MarkPrice, IndexPrice, default:LastPrice
reduceOnlyfalsebooleanWhat is a reduce-only order? true means your position can only reduce in size if this order is triggered. When reduce_only is true, take profit/stop loss cannot be set
closeOnTriggerfalsebooleanWhat is a close on trigger order? For a closing order. It can only reduce your position, not increase it. If the account has insufficient available balance when the closing order is triggered, then other active orders of similar contracts will be cancelled or reduced. It can be used to ensure your stop loss reduces your position regardless of current available margin.
mmpfalsebooleanMarket maker protection. true means this order is a market maker protection order

Response Parameters

ParameterTypeComments
orderIdstringOrder ID
orderLinkIdstringUser customised order id

Request Example

curl --location --request POST 'https://api-testnet.bybit.com/unified/v3/private/order/create' \
--header 'X-BAPI-SIGN-TYPE: 2' \
--header 'X-BAPI-SIGN: XXXXXX' \
--header 'X-BAPI-API-KEY: {api key}' \
--header 'X-BAPI-TIMESTAMP: 1657871228347' \
--header 'X-BAPI-RECV-WINDOW: 5000' \
--header 'Content-Type: application/json' \
--data-raw '{
"symbol": "BTCUSDT",
"orderType": "Limit",
"side": "Buy",
"qty": "0.01",
"price": "20002",
"timeInForce": "GoodTillCancel",
"category": "linear"
}'

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"orderId": "e10b0716-7c91-4091-b98a-1fa0f401c7d5",
"orderLinkId": "test0000003"
},
"retExtInfo": {},
"time": 1664441344238
}