持仓分析 API

获取地址的单一代币最新收益#

获取地址的指定代币最新收益

请求路径#

GET https://web3.okx.com/api/v6/dex/market/portfolio/token/latest-pnl

请求参数#

参数类型必填描述
chainIndexString链的唯一标识,传入链的 ID(如 501: Solana)
walletAddressString查询的钱包地址
tokenContractAddressString代币合约地址

响应参数#

参数类型说明
totalPnlUsdString总收益(USD)
totalPnlPercentString总收益百分比
unrealizedPnlUsdString未实现盈亏(USD)
unrealizedPnlPercentString未实现盈亏百分比
realizedPnlUsdString已实现盈亏(USD)
realizedPnlPercentString已实现盈亏百分比
isPnlSupportedBoolean是否支持 PnL 计算

请求示例#

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'

响应示例#

Json
{
    "code": 0,
    "data": {
        "totalPnlUsd": "1371.68",
        "totalPnlPercent": "20.22",
        "unrealizedPnlUsd": "685.4",
        "unrealizedPnlPercent": "10.11",
        "realizedPnlUsd": "-685.4",
        "realizedPnlPercent": "-10.11",
        "isPnlSupported": true
    }
}