Skip to main content

Place Order

This endpoint supports to create the order for Spot, Margin trading, USDT perpetual, USDC perpetual, USDC futures, Inverse Futures and Options.

info
  • Supported order type (orderType):
    Limit order: orderType=Limit, it is necessary to specify order qty and price.

    Market order: orderType=Market, execute at the best price in the Bybit market until the transaction is completed. When selecting a market order, the "price" can be empty. In the futures trading system, in order to protect the serious slippage of the market order, the Bybit trading system will convert the market order into a limit order for matching. will be cancelled. The slippage threshold refers to the percentage that the order price deviates from the latest transaction price. The current threshold is set to 3% for BTC contracts and 5% for other contracts.
  • Supported timeInForce strategy:
    GTC
    IOC
    FOK
    PostOnly: If the order would be filled immediately when submitted, it will be cancelled. The purpose of this is to protect your order during the submission process. If the matching system cannot entrust the order to the order book due to price changes on the market, it will be cancelled. For the PostOnly order type, the quantity that can be submitted in a single order is more than other types of orders, please refer to the parameter lotSizeFilter > postOnlyMaxOrderQty in the instruments-info endpoint.

  • How to create conditional order:
    When submitting an order, if triggerPrice is set, the order will be automatically converted into a conditional order. In addition, the conditional order does not occupy the margin. If the margin is insufficient after the conditional order is triggered, the order will be cancelled.

  • 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 have position, the price should be higher than the liquidation price. For the minimum unit of the price change, please refer to the priceFilter > tickSize field in the instruments-info endpoint.

  • 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, and if both orderId and orderLinkId are entered in the parameter input, Bybit will prioritize the orderId to process the corresponding order. Meanwhile, your customized order ID should be no longer than 36 characters and should be unique.

  • Open orders up limit:
    Perps & Futures:
    a) Each account can hold a maximum of 500 active orders simultaneously per symbol.
    b) conditional orders: each account can hold a maximum of 10 active orders simultaneously per symbol.
    Spot: 500 orders in total, including a maximum of 30 open TP/SL orders, a maximum of 30 open conditional orders for each symbol per account
    Option: a maximum of 50 open orders per account

  • Rate limit:
    Please refer to rate limit table. If you need to raise the rate limit, please contact your client manager or submit an application via here

  • Risk control limit notice:
    Bybit will monitor on your API requests. When the total number of orders of a single user (aggregated the number of orders across main account and sub-accounts) within a day (UTC 0 - UTC 24) exceeds a certain upper limit, the platform will reserve the right to remind, warn, and impose necessary restrictions. Customers who use API default to acceptance of these terms and have the obligation to cooperate with adjustments.

Spot Stop Order

Spot supports TP/SL order, Conditional order, however, the system logic is different between classic account and Unified account
classic account: When the stop order is created, you will get an order ID. After it is triggered, you will get a new order ID
Unified account: When the stop order is created, you will get an order ID. After it is triggered, the order ID will not be changed

HTTP Request

POST /v5/order/create

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type
  • UTA2.0, UTA1.0: linear, inverse, spot, option
  • classic account: linear, inverse, spot
symboltruestringSymbol name, like BTCUSDT, uppercase only
isLeveragefalseintegerWhether to borrow. Unified account Spot trading only.
  • 0(default): false, spot trading
  • 1: true, margin trading, make sure you turn on margin trading, and set the relevant currency as collateral
  • sidetruestringBuy, Sell
    orderTypetruestringMarket, Limit
    qtytruestringOrder quantity
    • UTA account
      • Spot: Market Buy order by value by default, you can set marketUnit field to choose order by value or qty for market orders
      • Perps, Futures & Option: always order by qty
    • classic account
      • Spot: Market Buy order by value by default
      • Perps, Futures: always order by qty
    • Perps & Futures: if you pass qty="0" and specify reduceOnly=true&closeOnTrigger=true, you can close the position up to maxMktOrderQty or maxOrderQty shown on Get Instruments Info of current symbol
    marketUnitfalsestringSelect the unit for qty when create Spot market orders for UTA account
  • baseCoin: for example, buy BTCUSDT, then "qty" unit is BTC
  • quoteCoin: for example, sell BTCUSDT, then "qty" unit is USDT
  • pricefalsestringOrder price
    • Market order will ignore this field
    • Please check the min price and price precision from instrument info endpoint
    • If you have position, price needs to be better than liquidation price
    triggerDirectionfalseintegerConditional order param. Used to identify the expected direction of the conditional order.
    • 1: triggered when market price rises to triggerPrice
    • 2: triggered when market price falls to triggerPrice
    Valid for linear & inverse
    orderFilterfalsestringIf it is not passed, Order by default.
    • Order
    • tpslOrder: Spot TP/SL order, the assets are occupied even before the order is triggered
    • StopOrder: Spot conditional order, the assets will not be occupied until the price of the underlying asset reaches the trigger price, and the required assets will be occupied after the Conditional order is triggered
    Valid for spot only
    triggerPricefalsestring
    • For Perps & Futures, it is the conditional order trigger price. If you expect the price to rise to trigger your conditional order, make sure:
      triggerPrice > market price
      Else, triggerPrice < market price
    • For spot, it is the TP/SL and Conditional order trigger price
    triggerByfalsestringTrigger price type, Conditional order param for Perps & Futures.
  • LastPrice
  • IndexPrice
  • MarkPrice
  • Valid for linear & inverse
    orderIvfalsestringImplied volatility. option only. Pass the real value, e.g for 10%, 0.1 should be passed. orderIv has a higher priority when price is passed as well
    timeInForcefalsestringTime in force
    • Market order will use IOC directly
    • If not passed, GTC is used by default
    positionIdxfalseintegerUsed to identify positions in different position modes. Under hedge-mode, this param is required
    • 0: one-way mode
    • 1: hedge-mode Buy side
    • 2: hedge-mode Sell side
    orderLinkIdfalsestringUser customised order ID. A max of 36 characters. Combinations of numbers, letters (upper and lower cases), dashes, and underscores are supported.
    Futures & Perps: orderLinkId rules:
    • optional param
    • always unique
    • option orderLinkId rules:
    • required param
    • always unique
    takeProfitfalsestringTake profit price
  • UTA: Spot Limit order supports take profit, stop loss or limit take profit, limit stop loss when creating an order
  • stopLossfalsestringStop loss price
  • UTA: Spot Limit order supports take profit, stop loss or limit take profit, limit stop loss when creating an order
  • tpTriggerByfalsestringThe price type to trigger take profit. MarkPrice, IndexPrice, default: LastPrice. Valid for linear & inverse
    slTriggerByfalsestringThe price type to trigger stop loss. MarkPrice, IndexPrice, default: LastPrice. Valid for linear & inverse
    reduceOnlyfalsebooleanWhat is a reduce-only order? true means your position can only reduce in size if this order is triggered.
    • You must specify it as true when you are about to close/reduce the position
    • When reduceOnly is true, take profit/stop loss cannot be set
    Valid for linear, inverse & option
    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.
    Valid for linear & inverse
    smpTypefalsestringSmp execution type. What is SMP?
    mmpfalsebooleanMarket maker protection. option only. true means set the order as a market maker protection order. What is mmp?
    tpslModefalsestringTP/SL mode
    • Full: entire position for TP/SL. Then, tpOrderType or slOrderType must be Market
    • Partial: partial position tp/sl (as there is no size option, so it will create tp/sl orders with the qty you actually fill). Limit TP/SL order are supported. Note: When create limit tp/sl, tpslMode is required and it must be Partial
    Valid for linear & inverse
    tpLimitPricefalsestringThe limit order price when take profit price is triggered
    • linear & inverse: only works when tpslMode=Partial and tpOrderType=Limit
    • Spot(UTA): it is required when the order has takeProfit and "tpOrderType"=Limit
    slLimitPricefalsestringThe limit order price when stop loss price is triggered
    • linear & inverse: only works when tpslMode=Partial and slOrderType=Limit
    • Spot(UTA): it is required when the order has stopLoss and "slOrderType"=Limit
    tpOrderTypefalsestringThe order type when take profit is triggered
    • linear & inverse: Market(default), Limit. For tpslMode=Full, it only supports tpOrderType=Market
    • Spot(UTA):
      Market: when you set "takeProfit",
      Limit: when you set "takeProfit" and "tpLimitPrice"
    slOrderTypefalsestringThe order type when stop loss is triggered
    • linear & inverse: Market(default), Limit. For tpslMode=Full, it only supports slOrderType=Market
    • Spot(UTA):
      Market: when you set "stopLoss",
      Limit: when you set "stopLoss" and "slLimitPrice"

    Response Parameters

    ParameterTypeComments
    orderIdstringOrder ID
    orderLinkIdstringUser customised order ID
    info

    The ack of create order request indicates that the request is successfully accepted. Please use websocket order stream to confirm the order status


    Request Example

    POST /v5/order/create HTTP/1.1
    Host: api-testnet.bybit.com
    X-BAPI-SIGN: XXXXX
    X-BAPI-API-KEY: XXXXX
    X-BAPI-TIMESTAMP: 1672211928338
    X-BAPI-RECV-WINDOW: 5000
    Content-Type: application/json

    // Spot Limit order with market tp sl
    {"category": "spot","symbol": "BTCUSDT","side": "Buy","orderType": "Limit","qty": "0.01","price": "28000","timeInForce": "PostOnly","takeProfit": "35000","stopLoss": "27000","tpOrderType": "Market","slOrderType": "Market"}

    // Spot Limit order with limit tp sl
    {"category": "spot","symbol": "BTCUSDT","side": "Buy","orderType": "Limit","qty": "0.01","price": "28000","timeInForce": "PostOnly","takeProfit": "35000","stopLoss": "27000","tpLimitPrice": "36000","slLimitPrice": "27500","tpOrderType": "Limit","slOrderType": "Limit"}

    // Spot PostOnly normal order
    {"category":"spot","symbol":"BTCUSDT","side":"Buy","orderType":"Limit","qty":"0.1","price":"15600","timeInForce":"PostOnly","orderLinkId":"spot-test-01","isLeverage":0,"orderFilter":"Order"}

    // Spot TP/SL order
    {"category":"spot","symbol":"BTCUSDT","side":"Buy","orderType":"Limit","qty":"0.1","price":"15600","triggerPrice": "15000", "timeInForce":"Limit","orderLinkId":"spot-test-02","isLeverage":0,"orderFilter":"tpslOrder"}

    // Spot margin normal order (UTA)
    {"category":"spot","symbol":"BTCUSDT","side":"Buy","orderType":"Limit","qty":"0.1","price":"15600","timeInForce":"Limit","orderLinkId":"spot-test-limit","isLeverage":1,"orderFilter":"Order"}

    // Spot Market Buy order, qty is quote currency
    {"category":"spot","symbol":"BTCUSDT","side":"Buy","orderType":"Market","qty":"200","timeInForce":"IOC","orderLinkId":"spot-test-04","isLeverage":0,"orderFilter":"Order"}


    // USDT Perp open long position (one-way mode)
    {"category":"linear","symbol":"BTCUSDT","side":"Buy","orderType":"Limit","qty":"1","price":"25000","timeInForce":"GTC","positionIdx":0,"orderLinkId":"usdt-test-01","reduceOnly":false,"takeProfit":"28000","stopLoss":"20000","tpslMode":"Partial","tpOrderType":"Limit","slOrderType":"Limit","tpLimitPrice":"27500","slLimitPrice":"20500"}

    // USDT Perp close long position (one-way mode)
    {"category": "linear", "symbol": "BTCUSDT", "side": "Sell", "orderType": "Limit", "qty": "1", "price": "30000", "timeInForce": "GTC", "positionIdx": 0, "orderLinkId": "usdt-test-02", "reduceOnly": true}

    Response Example

    {
    "retCode": 0,
    "retMsg": "OK",
    "result": {
    "orderId": "1321003749386327552",
    "orderLinkId": "spot-test-postonly"
    },
    "retExtInfo": {},
    "time": 1672211918471
    }