Place Order
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
Parameter | Required | Type | Comments |
---|---|---|---|
category | true | string | Product type. linear , option |
symbol | true | string | Symbol name |
side | true | string | Buy , Sell |
orderType | true | string | Market , Limit |
qty | true | string | Order quantity |
price | false | string | Order price. Invalid if orderType =Market |
basePrice | false | string |
|
triggerPrice | false | string | If you expect the price to rise to trigger your conditional order, make sure: triggerPrice > max(market price, basePrice) Else, triggerPrice < min(market price, basePrice) |
triggerBy | false | string | Trigger price type. LastPrice , IndexPrice , MarkPrice |
orderIv | false | string | Implied volatility. option only. Pass the real value, e.g for 10%, 0.1 should be passed |
timeInForce | true | string | Time in force. GoodTillCancel , ImmediateOrCancel , FillOrKill , PostOnly |
positionIdx | false | integer | Position mode. 0 : one-way mode. |
orderLinkId | false | string | User customised order id. A max of 36 characters. Combinations of numbers, letters (upper and lower cases), dashes, and underscores are supported. rule of future :
option : |
takeProfit | false | string | Take profit price |
stopLoss | false | string | Stop loss price |
tpTriggerBy | false | string | The price type to trigger take profit. MarkPrice , IndexPrice , default:LastPrice |
slTriggerBy | false | string | The price type to trigger stop loss. MarkPrice , IndexPrice , default:LastPrice |
reduceOnly | false | boolean | What 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 |
closeOnTrigger | false | boolean | What 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. |
mmp | false | boolean | Market maker protection. true means this order is a market maker protection order |
Response Parameters
Parameter | Type | Comments |
---|---|---|
orderId | string | Order ID |
orderLinkId | string | User 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
}