> ## Documentation Index
> Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Top Trader Wallets for Token Query

This GraphQL query returns the top 20 trader wallets - ranked by trading volume over the last 30 days - for a specific token, along with detailed information about their holdings, transaction activity, and realized and unrealized profit/loss metrics.

<CardGroup cols={2}>
  <Card title="Credit Cost"> 1 per call </Card>

  <Card title="Supported Chains">
    * `BASE_MAINNET`
    * `BSC_MAINNET`
    * `ETH_MAINNET`
    * `GNOSIS_MAINNET`
    * `MEGAETH_MAINNET`
    * `OPTIMISM_MAINNET`
    * `POLYGON_MAINNET`
  </Card>
</CardGroup>

<Tip>
  Estimate your monthly cost for this API using the [Pricing Calculator](/pricing-calculator?endpoint=%2Fapi-reference%2Fstreaming-api%2Fqueries%2Fupnl-for-token-query).
</Tip>

## Parameters

<ParamField body="chain_name" type="enum" required>
  Blockchain network to filter events
</ParamField>

<ParamField body="token_address" type="string" required>
  Token contract address on a supported DEX and chain
</ParamField>

## Query

You can query the `upnlForToken` endpoint to retrieve top wallet trading data.

```graphql theme={null}
query {
  upnlForToken(
    chain_name: ETH_MAINNET
    token_address: "0x7ABc8A5768E6bE61A6c693a6e4EAcb5B60602C4D"
  ) {
    volume
    wallet_address
    transactions_count
    balance
    contract_metadata {
      contract_name
      contract_address
      contract_decimals
      contract_ticker_symbol
    }
    token_address
    pnl_realized_usd
    pnl_unrealized_usd
    marketcap_usd
    balance_pretty
  }
}
```

## Response Format

Here's an example of the response data structure:

```json theme={null}
{
  "data": {
    "upnlForToken": [
      {
        "token_address": "0x7abc8a5768e6be61a6c693a6e4eacb5b60602c4d",
        "wallet_address": "0x91d40e4818f4d4c57b4578d9eca6afc92ac8debe",
        "volume": "56708716",
        "transactions_count": 554,
        "pnl_realized_usd": -43239.81,
        "balance": "32944375440228563000000000",
        "balance_pretty": "32944375.4402",
        "pnl_unrealized_usd": 535182,
        "contract_metadata": {
          "contract_address": "0x7ABc8A5768E6bE61A6c693a6e4EAcb5B60602C4D",
          "contract_name": "Covalent X Token",
          "contract_ticker_symbol": "CXT",
          "contract_decimals": 18
        }
      },
      {
        "token_address": "0x7abc8a5768e6be61a6c693a6e4eacb5b60602c4d",
        "wallet_address": "0xfe97b0c517a84f98fc6ede3cd26b43012d31992a",
        "volume": "39102028",
        "transactions_count": 241,
        "pnl_realized_usd": 8799.58,
        "balance": "323138960338677960000000000",
        "balance_pretty": "323138960.3387",
        "pnl_unrealized_usd": 6417132,
        "contract_metadata": {
          "contract_address": "0x7ABc8A5768E6bE61A6c693a6e4EAcb5B60602C4D",
          "contract_name": "Covalent X Token",
          "contract_ticker_symbol": "CXT",
          "contract_decimals": 18
        }
      }
    ]
  }
}
```

### Field Descriptions

<ResponseField name="volume" type="string">
  Total volume of tokens transferred (string to avoid JS precision loss)
</ResponseField>

<ResponseField name="wallet_address" type="string">
  Wallet address of the token holder (lowercase with 0x prefix)
</ResponseField>

<ResponseField name="transactions_count" type="int">
  Total number of transactions
</ResponseField>

<ResponseField name="balance" type="string">
  Current token balance (string to avoid JS precision loss)
</ResponseField>

<ResponseField name="contract_metadata" type="object">
  Token contract metadata

  Type: [`TokenContractMetadata`](/api-reference/streaming-api/types/token-contract-metadata)

  <Expandable title="properties">
    <ResponseField name="contract_name" type="string">
      Name of the token contract
    </ResponseField>

    <ResponseField name="contract_address" type="string">
      Address of the token contract
    </ResponseField>

    <ResponseField name="contract_decimals" type="int">
      Number of decimal places for the token
    </ResponseField>

    <ResponseField name="contract_ticker_symbol" type="string">
      Ticker symbol of the token
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="token_address" type="string">
  Token contract address (lowercase with 0x prefix)
</ResponseField>

<ResponseField name="pnl_realized_usd" type="float">
  Realized profit and loss in USD
</ResponseField>

<ResponseField name="pnl_unrealized_usd" type="float">
  Unrealized profit and loss in USD
</ResponseField>

<ResponseField name="marketcap_usd" type="string">
  Market capitalization in USD
</ResponseField>

<ResponseField name="balance_pretty" type="string">
  Human-readable token balance with proper decimal places
</ResponseField>
