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.
Supported Chains
BASE_MAINNET
BSC_MAINNET
ETH_MAINNET
GNOSIS_MAINNET
MEGAETH_MAINNET
OPTIMISM_MAINNET
POLYGON_MAINNET
Parameters
Blockchain network to filter events
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
}
}
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
Token contract metadata Type: TokenContractMetadata Name of the token contract
Address of the token contract
Number of decimal places for the token
Ticker symbol of the token
Net token movement (inflow - outflow) in the last 7 days, not the actual on-chain balance
Token contract address (lowercase with 0x prefix)
Realized profit and loss in USD
Unrealized profit and loss in USD
Market capitalization in USD