Query Portfolio History Position

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Rate Limit: 30 requests per 10 seconds.

Query closed position history for the current portfolio. Returns up to 90 days of historical data by default.

Request Parameters

FieldTypeMandatoryDescription
symStringNTrading pair unique identifier. e.g. BINANCE_PERP_BTC_USDT, OKX_PERP_BTC_USDT, EDX_PERP_ETH_USDT.
exchangeStringNExchange filter. e.g. BINANCE, OKX, EDX.
beginStringNStart time. Default is up to 90 days ago. Unix timestamp in milliseconds.
endStringNEnd time. Unix timestamp in milliseconds.
pageStringNCurrent page. Default 1.
pageSizeStringNPage size. Default 1000, max 1000.

Response Fields

Top-level:

FieldTypeDescription
codeIntegerBusiness status code. 200000 indicates success.
messageStringText message for the response.
dataObjectPagination information and position list.

Data object:

FieldTypeDescription
pageIntegerCurrent page index, starting from 1.
pageSizeIntegerPage size used for this query.
pageNumIntegerTotal number of pages.
totalSizeIntegerTotal number of records matching the filters.
listArrayList of closed position records.

Position record (list[]):

FieldTypeDescription
positionIdStringPosition ID.
portfolioIdStringPortfolio ID.
portfolioNameStringPortfolio name. May be null.
symStringTrading pair unique identifier.
closedTypeStringHow the position was closed: PARTIAL_CLOSED, COMPLETE_CLOSED, LIQUIDATION, or SYSTEM_COMPLETE_CLOSED.
closedPnlStringRealized PNL from the close.
closedPnlRatioStringRealized PNL ratio.
closedAvgPriceStringAverage closing price.
maxPositionQtyStringMaximum position quantity held. Unit: contracts for OKX, base currency for BINANCE.
closedQtyStringClosed quantity. Unit: contracts for OKX, base currency for BINANCE.
liqFeeStringLiquidation fee (if applicable).
fundingFeeStringFunding fee.
feeStringTrading fee.
leverageIntegerLeverage at the time of closing.
openAvgPriceStringAverage opening price.
positionHistorySideStringPosition side: LONG, SHORT, or NONE.
createAtStringPosition creation timestamp in milliseconds.
updateAtStringLast update timestamp in milliseconds.
positionModeStringPosition mode at the time: NET or BOTH.

Example Response

{
  "code": 200000,
  "message": "Success",
  "data": {
    "page": 1,
    "pageSize": 1000,
    "pageNum": 1,
    "totalSize": 1,
    "list": [
      {
        "positionId": "20168941947142980",
        "portfolioId": "17xxxxxxxxxxxxxx",
        "portfolioName": null,
        "sym": "BINANCE_PERP_BTC_USDT",
        "closedType": "COMPLETE_CLOSED",
        "closedPnl": "-0.0066",
        "closedPnlRatio": "-0.00411522633744856",
        "closedAvgPrice": "1.214",
        "maxPositionQty": "6.6",
        "closedQty": "6.6",
        "liqFee": "0",
        "fundingFee": "0",
        "fee": "0.0028055",
        "openAvgPrice": "1.215",
        "leverage": 5,
        "positionHistorySide": "LONG",
        "positionMode": "NET",
        "createAt": "1775987218376",
        "updateAt": "1775987219638"
      }
    ]
  }
}
Query Params
string
string
string
string
string
Defaults to 1
string
Defaults to 1000
Responses

Language
LoadingLoading…
Response
Choose an example:
application/json