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
  • You can query filled, cancelled, and rejected orders to the most recent 500 orders for spot, linear, inverse and option categories
  • 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
  • After a server release or restart, filled, cancelled, and rejected orders of Unified account should only be queried through order history.

HTTP Request

GET /v5/order/realtime

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type linear, inverse, spot, option
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
    • option: USDT or USDC
    orderIdfalsestringOrder ID
    orderLinkIdfalsestringUser customised order ID
    openOnlyfalseinteger
    • 0(default): query open status orders (e.g., New, PartiallyFilled) only
    • 1: 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
    • 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 0: false, 1: true
    > positionIdxintegerPosition index. Used to identify positions in different position modes.
    > orderStatusstringOrder status
    > createTypestringOrder create type
  • Spot does not have this key
  • > cancelTypestringCancel type
    > rejectReasonstringReject reason
    > avgPricestringAverage filled price, returns "" for those orders without avg price
    > leavesQtystringThe remaining qty not executed
    > leavesValuestringThe estimated value not executed
    > cumExecQtystringCumulative executed order qty
    > cumExecValuestringCumulative executed order value
    > cumExecFeestring
  • inverse, option: Cumulative executed trading fee.
  • linear, spot: Deprecated. Use cumFeeDetail instead.
  • > timeInForcestringTime in force
    > orderTypestringOrder type. Market,Limit. For TP/SL orders, is the order type after the order was triggered
    > stopOrderTypestringStop order type
    > orderIvstringImplied volatility
    > marketUnitstringThe unit for qty when create Spot market orders. 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
    > 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, Spot is not applicable
    > basePricestringLast price when place the order, Spot has this field only
    > 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)
    > cumFeeDetailjson
  • linear, spot: Cumulative trading fee details instead of cumExecFee

  • 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: xxxxxxxxxxxxxxxxxx
    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",
    "cumFeeDetail": {
    "MNT": "0.00242968"
    }
    }
    ],
    "nextPageCursor": "page_args%3Dfd4300ae-7847-404e-b947-b46980a4d140%26symbol%3D6%26",
    "category": "linear"
    },
    "retExtInfo": {},
    "time": 1684765770483
    }