Skip to main content

Get Pre-upgrade Order History

After the account is upgraded to a Unified account, you can get the orders which occurred before the upgrade.

  • UTA2.0:
    By category=linear, you can query USDT Perps, USDC Perps data occurred during classic account
    By category=spot, you can query Spot data occurred during classic account
    By category=option, you can query Options data occurred during classic account
    By category=inverse, you can query Inverse Contract data occurred during classic account or UTA1.0

  • UTA1.0:
    By category=linear, you can query USDT Perps, USDC Perps data occurred during classic account
    By category=spot, you can query Spot data occurred during classic account
    By category=option, you can query Options data occurred during classic account

info
  • can get all status in 7 days
  • can only get filled orders beyond 7 days
  • USDC Perpeual & Option support the recent 6 months data. Please download older data via GUI

HTTP Request

GET /v5/pre-upgrade/order/history

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type linear, inverse, option, spot
symbolfalsestringSymbol name, like BTCUSDT, uppercase only.
  • If not passed, return settleCoin=USDT by default
  • To get USDC perp, please pass symbol
baseCoinfalsestringBase coin, uppercase only. Used for option query
orderIdfalsestringOrder ID
orderLinkIdfalsestringUser customised order ID
orderFilterfalsestringOrder: active order, StopOrder: conditional order
orderStatusfalsestringOrder status. Not supported for spot category
startTimefalseintegerThe start timestamp (ms)
  • startTime and endTime must be passed together or both are not passed
  • endTime - startTime <= 7 days
  • If both are not passed, it returns recent 7 days by default
endTimefalseintegerThe end timestamp (ms)
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
listarrayObject
> orderIdstringOrder ID
> orderLinkIdstringUser customised order ID
> blockTradeIdstringBlock trade ID
> symbolstringSymbol name
> pricestringOrder price
> qtystringOrder qty
> sidestringSide. Buy,Sell
> isLeveragestringUseless field for those orders before upgraded
> positionIdxintegerPosition index. Used to identify positions in different position modes
> orderStatusstringOrder status
> cancelTypestringCancel type
> rejectReasonstringReject reason
> avgPricestringAverage filled price. If unfilled, it is "", and also for those orders have partilly filled but cancelled at the end
> leavesQtystringThe remaining qty not executed
> leavesValuestringThe estimated value not executed
> cumExecQtystringCumulative executed order qty
> cumExecValuestringCumulative executed order value
> cumExecFeestringCumulative executed trading fee
> timeInForcestringTime in force
> orderTypestringOrder type. Market,Limit
> stopOrderTypestringStop order type
> orderIvstringImplied volatility
> triggerPricestringTrigger price. If stopOrderType=TrailingStop, it is activate price. Otherwise, it is trigger price
> takeProfitstringTake profit price
> stopLossstringStop loss price
> 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)
nextPageCursorstringRefer to the cursor request parameter

Request Example

GET /v5/pre-upgrade/order/history?category=linear&limit=1&orderStatus=Filled HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1682576940304
X-BAPI-RECV-WINDOW: 5000

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"orderId": "67836246-460e-4c52-a009-af0c3e1d12bc",
"orderLinkId": "",
"blockTradeId": "",
"symbol": "BTCUSDT",
"price": "27203.40",
"qty": "0.200",
"side": "Sell",
"isLeverage": "",
"positionIdx": 0,
"orderStatus": "Filled",
"cancelType": "UNKNOWN",
"rejectReason": "EC_NoError",
"avgPrice": "28632.126000",
"leavesQty": "0.000",
"leavesValue": "0",
"cumExecQty": "0.200",
"cumExecValue": "5726.4252",
"cumExecFee": "3.43585512",
"timeInForce": "IOC",
"orderType": "Market",
"stopOrderType": "UNKNOWN",
"orderIv": "",
"triggerPrice": "0.00",
"takeProfit": "0.00",
"stopLoss": "0.00",
"tpTriggerBy": "UNKNOWN",
"slTriggerBy": "UNKNOWN",
"triggerDirection": 0,
"triggerBy": "UNKNOWN",
"lastPriceOnCreated": "0.00",
"reduceOnly": true,
"closeOnTrigger": true,
"smpType": "None",
"smpGroup": 0,
"smpOrderId": "",
"createdTime": "1682487465732",
"updatedTime": "1682487465735",
"placeType": ""
}
],
"nextPageCursor": "page_token%3D69406%26",
"category": "linear"
},
"retExtInfo": {},
"time": 1682576940540
}