Get Address Recent PnL List#
Get a list of recent PnL for an address in reverse chronological order
Limit: 1000 records, up to 100 per request
Request Path#
GET https://web3.okx.com/api/v6/dex/market/portfolio/recent-pnl
Request Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
| chainIndex | String | Yes | Unique identifier of the chain, pass the chain ID (e.g., 501 for Solana), only single-chain query is supported |
| walletAddress | String | Yes | Wallet address to query |
| cursor | String | No | Pagination cursor, pass the cursor value returned from the previous request |
| limit | String | No | Number of records per page, max 100 |
Response Parameters#
| Parameter | Type | Description |
|---|---|---|
| cursor | String | Pagination cursor |
| pnlList | Array | PnL list |
| >chainIndex | String | Unique identifier of the chain |
| >tokenContractAddress | String | Token contract address |
| >tokenSymbol | String | Token symbol |
| >lastActiveTimestamp | String | Last active timestamp (milliseconds) |
| >unrealizedPnlUsd | String | Unrealized PnL (USD), returns SELL_ALL if the address has sold all holdings |
| >unrealizedPnlPercent | String | Unrealized PnL percentage |
| >realizedPnlUsd | String | Realized PnL (USD) |
| >realizedPnlPercent | String | Realized PnL percentage |
| >totalPnlUsd | String | Total PnL (USD) |
| >totalPnlPercent | String | Total PnL percentage |
| >tokenBalanceUsd | String | Token balance value (USD) |
| >tokenBalanceAmount | String | Token balance amount |
| >tokenPositionPercent | String | Token position percentage |
| >tokenPositionDuration | Object | Token position duration info |
| >>holdingTimestamp | String | Holding start timestamp (milliseconds) |
| >>sellOffTimestamp | String | Sell-off timestamp (milliseconds), empty if still holding |
| >buyTxCount | String | Number of buy transactions |
| >buyTxVolume | String | Buy transaction volume |
| >buyAvgPrice | String | Average buy price |
| >sellTxCount | String | Number of sell transactions |
| >sellTxVolume | String | Sell transaction volume |
| >sellAvgPrice | String | Average sell price |
Request Example#
Shell
curl --location --request GET 'https://web3.okx.com/api/v6/dex/market/portfolio/recent-pnl?chainIndex=1&walletAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&limit=10' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'
Response Example#
Json
{
"code": "0",
"data": {
"pnlList": [
{
"chainIndex": "1",
"tokenContractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"tokenSymbol": "USDT",
"lastActiveTimestamp": "1710000000000",
"unrealizedPnlUsd": "100.00",
"unrealizedPnlPercent": "10.00",
"realizedPnlUsd": "200.00",
"realizedPnlPercent": "20.00",
"totalPnlUsd": "300.00",
"totalPnlPercent": "30.00",
"tokenBalanceUsd": "1000.00",
"tokenBalanceAmount": "1000",
"tokenPositionPercent": "10.00",
"tokenPositionDuration": {
"holdingTimestamp": "1700000000000",
"sellOffTimestamp": ""
},
"buyTxCount": "5",
"buyTxVolume": "900.00",
"buyAvgPrice": "0.99",
"sellTxCount": "2",
"sellTxVolume": "400.00",
"sellAvgPrice": "1.01"
}
]
},
"msg": ""
}