Portfolio API

Get Address Portfolio Overview#

Get overview data related to address PnL, including total realized and unrealized PnL, winning rate, Top3 PnL tokens, and buy and sell transaction statistics

Request Path#

GET https://web3.okx.com/api/v6/dex/market/portfolio/overview

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier of the chain, pass the chain ID (e.g., 501 for Solana), only single-chain query is supported
walletAddressStringYesWallet address to query
timeFrameStringYesStatistical range number for address transactions and PnL (1=1D, 2=3D, 3=7D, 4=1M, 5=3M)

Response Parameters#

ParameterTypeDescription
realizedPnlUsdStringRealized PnL (USD)
top3PnlTokenSumUsdStringTotal PnL of Top 3 tokens (USD)
top3PnlTokenPercentStringTop 3 tokens PnL percentage
topPnlTokenListArrayTop 3 PnL token list
>tokenContractAddressStringToken contract address
>tokenSymbolStringToken symbol
>tokenPnLUsdStringToken PnL (USD)
>tokenPnLPercentStringToken PnL percentage
winRateStringWin rate
tokenCountByPnlPercentObjectToken count statistics categorized by PnL percentage
>over500PercentStringNumber of tokens with PnL over 500%
>zeroTo500PercentStringNumber of tokens with PnL between 0% and 500%
>zeroToMinus50PercentStringNumber of tokens with PnL between -50% and 0%
>overMinus50PercentStringNumber of tokens with PnL below -50%
buyTxCountStringNumber of buy transactions
buyTxVolumeStringBuy transaction volume
sellTxCountStringNumber of sell transactions
sellTxVolumeStringSell transaction volume
avgBuyValueUsdStringAverage buy value (USD)
preferredMarketCapStringPreferred market cap range
buysByMarketCapArrayBuy statistics categorized by market cap
>marketCapRangeStringMarket cap range
>buyCountStringBuy count

Request Example#

Shell
curl --location --request GET 'https://web3.okx.com/api/v6/dex/market/portfolio/overview?chainIndex=1&walletAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&timeFrame=3' \
--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": {
        "realizedPnlUsd": "1500.00",
        "top3PnlTokenSumUsd": "1200.00",
        "top3PnlTokenPercent": "12.00",
        "topPnlTokenList": [
            {
                "tokenContractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
                "tokenSymbol": "USDT",
                "tokenPnLUsd": "500.00",
                "tokenPnLPercent": "5.00"
            }
        ],
        "winRate": "0.65",
        "tokenCountByPnlPercent": {
            "over500Percent": "2",
            "zeroTo500Percent": "10",
            "zeroToMinus50Percent": "3",
            "overMinus50Percent": "1"
        },
        "buyTxCount": "50",
        "buyTxVolume": "10000.00",
        "sellTxCount": "45",
        "sellTxVolume": "11500.00",
        "avgBuyValueUsd": "200.00",
        "preferredMarketCap": "Large",
        "buysByMarketCap": [
            {
                "marketCapRange": "Large",
                "buyCount": "30"
            },
            {
                "marketCapRange": "Mid",
                "buyCount": "15"
            },
            {
                "marketCapRange": "Small",
                "buyCount": "5"
            }
        ]
    },
    "msg": ""
}