Get Address Latest PnL for Specific Token#
Get the latest income of the specified token of the address
Request Path#
GET https://web3.okx.com/api/v6/dex/market/portfolio/token/latest-pnl
Request Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
| chainIndex | String | Yes | Unique identifier of the chain, pass the chain ID (e.g., 501 for Solana) |
| walletAddress | String | Yes | Wallet address to query |
| tokenContractAddress | String | Yes | Token contract address |
Response Parameters#
| Parameter | Type | Description |
|---|---|---|
| totalPnlUsd | String | Total PnL (USD) |
| totalPnlPercent | String | Total PnL percent |
| unrealizedPnlUsd | String | Unrealized PnL (USD) |
| unrealizedPnlPercent | String | Unrealized PnL percent |
| realizedPnlUsd | String | Realized PnL (USD) |
| realizedPnlPercent | String | Realized PnL percent |
| isPnlSupported | Boolean | Whether PnL calculation is supported |
Request Example#
Shell
curl --location --request GET 'https://web3.okx.com/api/v6/dex/market/portfolio/token/latest-pnl?chainIndex=1&walletAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&tokenContractAddress=0xdac17f958d2ee523a2206206994597c13d831ec7' \
--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": {
"totalPnlUsd": "1371.68",
"totalPnlPercent": "20.22",
"unrealizedPnlUsd": "685.4",
"unrealizedPnlPercent": "10.11",
"realizedPnlUsd": "-685.4",
"realizedPnlPercent": "-10.11",
"isPnlSupported": true
}
}