Skip to main content

Get Open & Closed Orders

Primarily query unfilled or partially filled orders in real-time, but also supports querying recent 500 closed status (Cancelled, Filled) orders. Please see the usage of request param openOnly.
And to query older order records, please use the order history interface.

tip
  • UTA2.0 can query filled, canceled, and rejected orders to the most recent 500 orders for spot, linear, inverse and option categories
  • UTA1.0 can query filled, canceled, and rejected orders to the most recent 500 orders for spot, linear, and option categories. The inverse category is not subject to this limitation.
  • You can query by symbol, baseCoin, orderId and orderLinkId, and if you pass multiple params, the system will process them according to this priority: orderId > orderLinkId > symbol > baseCoin.
  • The records are sorted by the createdTime from newest to oldest.
info
  • classic account spot can return open orders only
  • After a server release or restart, filled, canceled, and rejected orders of Unified account should only be queried through order history.

HTTP Request

GET /v5/order/realtime

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type
  • UTA2.0, UTA1.0: linear, inverse, spot, option
  • classic account: linear, inverse, spot
symbolfalsestringSymbol name, like BTCUSDT, uppercase only. For linear, either symbol, baseCoin, settleCoin is required
baseCoinfalsestringBase coin, uppercase only
  • Supports linear, inverse & option
  • option: it returns all option open orders by default
  • settleCoinfalsestringSettle coin, uppercase only
    • linear: either symbol, baseCoin or settleCoin is required
    • spot: not supported
    orderIdfalsestringOrder ID
    orderLinkIdfalsestringUser customised order ID
    openOnlyfalseinteger
    • 0(default): UTA2.0, UTA1.0, classic account query open status orders (e.g., New, PartiallyFilled) only
    • 1: UTA2.0, UTA1.0(except inverse)
      2: UTA1.0(inverse), classic account
      Query a maximum of recent 500 closed status records are kept under each account each category (e.g., Cancelled, Rejected, Filled orders).
      If the Bybit service is restarted due to an update, this part of the data will be cleared and accumulated again, but the order records will still be queried in order history
    • openOnly param will be ignored when query by orderId or orderLinkId
    • Classic spot: not supported
    orderFilterfalsestringOrder: active order, StopOrder: conditional order for Futures and Spot, tpslOrder: spot TP/SL order, OcoOrder: Spot oco order, BidirectionalTpslOrder: Spot bidirectional TPSL order
    • classic account spot: return Order active order by default
    • Others: all kinds of orders by default
    limitfalseintegerLimit for data size per page. [1, 50]. Default: 20
    cursorfalsestringCursor. Use the nextPageCursor token from the response to retrieve the next page of the result set

    Response Parameters

    ParameterTypeComments
    categorystringProduct type
    nextPageCursorstringRefer to the cursor request parameter
    listarrayObject
    > orderIdstringOrder ID
    > orderLinkIdstringUser customised order ID
    > blockTradeIdstringParadigm block trade ID
    > symbolstringSymbol name
    > pricestringOrder price
    > qtystringOrder qty
    > sidestringSide. Buy,Sell
    > isLeveragestringWhether to borrow. Unified spot only. 0: false, 1: true. Classic spot is not supported, always 0
    > positionIdxintegerPosition index. Used to identify positions in different position modes.
    > orderStatusstringOrder status
    > createTypestringOrder create type
  • Only for category=linear or inverse
  • Spot, Option do not have this key
  • > cancelTypestringCancel type
    > rejectReasonstringReject reason. Classic spot is not supported
    > avgPricestringAverage filled price
  • UTA: returns "" for those orders without avg price
  • classic account: returns "0" for those orders without avg price, and also for those orders have partilly filled but cancelled at the end
  • > leavesQtystringThe remaining qty not executed. Classic spot is not supported
    > leavesValuestringThe estimated value not executed. Classic spot is not supported
    > cumExecQtystringCumulative executed order qty
    > cumExecValuestringCumulative executed order value. Classic spot is not supported
    > cumExecFeestringCumulative executed trading fee. Classic spot is not supported
    > timeInForcestringTime in force
    > orderTypestringOrder type. Market,Limit. For TP/SL order, it means the order type after triggered
    > stopOrderTypestringStop order type
    > orderIvstringImplied volatility
    > marketUnitstringThe unit for qty when create Spot market orders for UTA account. baseCoin, quoteCoin
    > triggerPricestringTrigger price. If stopOrderType=TrailingStop, it is activate price. Otherwise, it is trigger price
    > takeProfitstringTake profit price
    > stopLossstringStop loss price
    > tpslModestringTP/SL mode, Full: entire position for TP/SL. Partial: partial position tp/sl. Spot does not have this field, and Option returns always ""
    > ocoTriggerBystringThe trigger type of Spot OCO order.OcoTriggerByUnknown, OcoTriggerByTp, OcoTriggerByBySl. Classic spot is not supported
    > tpLimitPricestringThe limit order price when take profit price is triggered
    > slLimitPricestringThe limit order price when stop loss price is triggered
    > tpTriggerBystringThe price type to trigger take profit
    > slTriggerBystringThe price type to trigger stop loss
    > triggerDirectionintegerTrigger direction. 1: rise, 2: fall
    > triggerBystringThe price type of trigger price
    > lastPriceOnCreatedstringLast price when place the order
    > reduceOnlybooleanReduce only. true means reduce position size
    > closeOnTriggerbooleanClose on trigger. What is a close on trigger order?
    > placeTypestringPlace type, option used. iv, price
    > smpTypestringSMP execution type
    > smpGroupintegerSmp group ID. If the UID has no group, it is 0 by default
    > smpOrderIdstringThe counterparty's orderID which triggers this SMP execution
    > createdTimestringOrder created timestamp (ms)
    > updatedTimestringOrder updated timestamp (ms)

    Request Example

    GET /v5/order/realtime?symbol=ETHUSDT&category=linear&openOnly=0&limit=1  HTTP/1.1
    Host: api-testnet.bybit.com
    X-BAPI-SIGN: XXXXX
    X-BAPI-API-KEY: XXXXX
    X-BAPI-TIMESTAMP: 1672219525810
    X-BAPI-RECV-WINDOW: 5000
    Content-Type: application/json

    Response Example

    {
    "retCode": 0,
    "retMsg": "OK",
    "result": {
    "list": [
    {
    "orderId": "fd4300ae-7847-404e-b947-b46980a4d140",
    "orderLinkId": "test-000005",
    "blockTradeId": "",
    "symbol": "ETHUSDT",
    "price": "1600.00",
    "qty": "0.10",
    "side": "Buy",
    "isLeverage": "",
    "positionIdx": 1,
    "orderStatus": "New",
    "cancelType": "UNKNOWN",
    "rejectReason": "EC_NoError",
    "avgPrice": "0",
    "leavesQty": "0.10",
    "leavesValue": "160",
    "cumExecQty": "0.00",
    "cumExecValue": "0",
    "cumExecFee": "0",
    "timeInForce": "GTC",
    "orderType": "Limit",
    "stopOrderType": "UNKNOWN",
    "orderIv": "",
    "triggerPrice": "0.00",
    "takeProfit": "2500.00",
    "stopLoss": "1500.00",
    "tpTriggerBy": "LastPrice",
    "slTriggerBy": "LastPrice",
    "triggerDirection": 0,
    "triggerBy": "UNKNOWN",
    "lastPriceOnCreated": "",
    "reduceOnly": false,
    "closeOnTrigger": false,
    "smpType": "None",
    "smpGroup": 0,
    "smpOrderId": "",
    "tpslMode": "Full",
    "tpLimitPrice": "",
    "slLimitPrice": "",
    "placeType": "",
    "createdTime": "1684738540559",
    "updatedTime": "1684738540561"
    }
    ],
    "nextPageCursor": "page_args%3Dfd4300ae-7847-404e-b947-b46980a4d140%26symbol%3D6%26",
    "category": "linear"
    },
    "retExtInfo": {},
    "time": 1684765770483
    }