Skip to main content

Get Pre-upgrade Closed PnL

Query user's closed profit and loss records from before you upgraded the account to a Unified account. The results are sorted by updatedTime in descending order.

it only supports to query USDT perpetual, Inverse perpetual and Inverse Futures.

  • UTA2.0:
    By category=linear, you can query USDT Perps 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 data occurred during classic account

HTTP Request

GET /v5/pre-upgrade/position/closed-pnl

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type linear, inverse
symboltruestringSymbol name, like BTCUSDT, uppercase only
startTimefalseintegerThe start timestamp (ms)
  • startTime and endTime are not passed, return 7 days by default
  • Only startTime is passed, return range between startTime and startTime+7 days
  • Only endTime is passed, return range between endTime-7 days and endTime
  • If both are passed, the rule is endTime - startTime <= 7 days
endTimefalseintegerThe end timestamp (ms)
limitfalseintegerLimit for data size per page. [1, 100]. Default: 50
cursorfalsestringCursor. Use the nextPageCursor token from the response to retrieve the next page of the result set

Response Parameters

ParameterTypeComments
categorystringProduct type
listarrayObject
> symbolstringSymbol name
> orderIdstringOrder ID
> sidestringBuy, Side
> qtystringOrder qty
> orderPricestringOrder price
> orderTypestringOrder type. Market,Limit
> execTypestringExec type. Trade, BustTrade, SessionSettlePnL, Settle
> closedSizestringClosed size
> cumEntryValuestringCumulated Position value
> avgEntryPricestringAverage entry price
> cumExitValuestringCumulated exit position value
> avgExitPricestringAverage exit price
> closedPnlstringClosed PnL
> fillCountstringThe number of fills in a single order
> leveragestringleverage
> createdTimestringThe created time (ms)
> updatedTimestringThe updated time (ms)
nextPageCursorstringRefer to the cursor request parameter

Request Example

GET /v5/pre-upgrade/position/closed-pnl?category=linear&symbol=BTCUSDT HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1682580911998
X-BAPI-RECV-WINDOW: 5000

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"symbol": "BTCUSDT",
"orderId": "67836246-460e-4c52-a009-af0c3e1d12bc",
"side": "Sell",
"qty": "0.200",
"orderPrice": "27203.40",
"orderType": "Market",
"execType": "Trade",
"closedSize": "0.200",
"cumEntryValue": "5588.88",
"avgEntryPrice": "27944.40",
"cumExitValue": "5726.4252",
"avgExitPrice": "28632.13",
"closedPnl": "204.25510011",
"fillCount": "22",
"leverage": "10",
"createdTime": "1682487465732",
"updatedTime": "1682487465732"
}
],
"category": "linear",
"nextPageCursor": ""
},
"retExtInfo": {},
"time": 1682580912259
}