Skip to main content
This GraphQL query provides detailed financial metrics, including unrealized and realized profit and loss (PnL), current balance, and transaction insights for each token held by a specific wallet address.

Credit Cost

TBD

Supported Chains

  • BASE_MAINNET
  • BSC_MAINNET
  • ETH_MAINNET
  • GNOSIS_MAINNET
  • MEGAETH_MAINNET
  • OPTIMISM_MAINNET
  • POLYGON_MAINNET
This query is currently in Beta. It is stable for testing and evaluation but may undergo changes in schema or behavior as we continue to improve it. No API credits are currently charged.We welcome your feedback so please reach out to us directly to report issues or request features.

Parameters

chain_name
enum
required
Blockchain network to filter eventsType: ChainNameUpnl
wallet_address
string
required
The wallet address to query

Query

You can query the upnlForWallet endpoint to retrieve detailed PnL metrics for a wallet.
query {
  upnlForWallet(
    chain_name: ETH_MAINNET
    wallet_address: "0xfe97b0C517a84F98fc6eDe3CD26B43012d31992a"
  ) {
    cost_basis
    contract_metadata {
      contract_name
      contract_address
      contract_decimals
      contract_ticker_symbol
    }
    net_balance_change
    token_address
    current_price
    pnl_realized_usd
    pnl_unrealized_usd
    marketcap_usd
  }
}

Response Format

Here’s an example of the response data structure:
{
  "data": {
    "upnlForWallet": [
      {
        "token_address": "0x7abc8a5768e6be61a6c693a6e4eacb5b60602c4d",
        "cost_basis": 0.03219392,
        "current_price": 0.032418,
        "pnl_realized_usd": null,
        "pnl_unrealized_usd": 318.22842,
        "net_balance_change": "1420158",
        "marketcap_usd": "32418001.4431",
        "contract_metadata": {
          "contract_address": "0x7abc8a5768e6be61a6c693a6e4eacb5b60602c4d",
          "contract_name": "Covalent X Token",
          "contract_ticker_symbol": "CXT",
          "contract_decimals": 18
        }
      }
    ]
  }
}

Field Descriptions

cost_basis
float
Cost basis per token
contract_metadata
object
Token contract metadataType: TokenContractMetadata
net_balance_change
string
Net token movement (inflow - outflow) in the last 7 days, not the actual on-chain balance
token_address
string
Token contract address (lowercase with 0x prefix)
current_price
float
Current price per token
pnl_realized_usd
float
Realized profit and loss in USD
pnl_unrealized_usd
float
Unrealized profit and loss in USD
marketcap_usd
string
Market capitalization in USD