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

# Top Token Traders by Token Address

> To query top token traders based on the provided token contract address on a network

export const CacheInfo = ({publicRate, paidRate, rate}) => {
  const fmt = v => v === 0 ? 'Real-time (Cacheless)' : `Every ${v}`;
  if (rate !== undefined) {
    return <Callout icon="clock-rotate-left" color="#2196F3" iconType="regular">
        <strong>Cache / Update Frequency:</strong><br />{fmt(rate)}
      </Callout>;
  }
  if (publicRate !== undefined && paidRate !== undefined) {
    return <Callout icon="clock-rotate-left" color="#2196F3" iconType="regular">
        <strong>Cache / Update Frequency:</strong><ul><li>{fmt(paidRate)} (Paid API)</li><li>{fmt(publicRate)} (Demo / Keyless API)</li></ul>
      </Callout>;
  }
  return null;
};

export const PlanExclusivity = ({tier}) => {
  if (tier === "enterprise") {
    return <Callout icon="crown" color="#FFC107" iconType="regular">
        <strong>Enterprise Only</strong><br />This endpoint is exclusively available to <strong>Enterprise</strong> plan.<br /><a href="https://www.coingecko.com/en/api/enterprise">→ Contact sales</a>
      </Callout>;
  }
  if (tier === "analyst_above") {
    return <Callout icon="briefcase" color="#FFC107" iconType="regular">
        <strong>Analyst Plan and Above</strong><br />This endpoint is only available to <strong>Analyst, Lite, Pro, and Enterprise</strong> plan.<br /><a href="https://www.coingecko.com/en/api/pricing">→ View pricing</a>
      </Callout>;
  }
  if (tier === "basic_above") {
    return <Callout icon="briefcase" color="#FFC107" iconType="regular">
        <strong>Basic Plan and Above</strong><br />This endpoint is only available to <strong>Basic, Analyst, Lite, Pro, and Enterprise</strong> plan.<br /><a href="https://www.coingecko.com/en/api/pricing">→ View pricing</a>
      </Callout>;
  }
  throw new Error(`PlanExclusivity: invalid tier "${tier}". Use "basic_above", "analyst_above", or "enterprise".`);
};

#### Notes

* Top traders data is currently in **Beta**, with ongoing improvements to data quality, coverage, and update frequency.
* Only tokens created after 1 September 2023 are supported.
* Stablecoins and wrapped native tokens (e.g. wSOL, wETH) are not supported.
* Use the `traders` param to specify the number of top traders to retrieve (max 50).

<PlanExclusivity tier="analyst_above" />

<CacheInfo rate="60 seconds" />

#### SDK Examples

<CodeGroup>
  ```typescript TypeScript theme={null}
  const response = await client.onchain.networks.tokens.topTraders.get('Dfh5DzRgSvvCFDoYc2ciTkMrbDfRKybA4SoFbPmApump', {
    network_id: 'solana',
  });

  console.log(JSON.stringify(response, null, 2));
  ```

  ```python Python theme={null}
  response = client.onchain.networks.tokens.top_traders.get(
    "Dfh5DzRgSvvCFDoYc2ciTkMrbDfRKybA4SoFbPmApump",
    network_id="solana",
  )

  print(response.model_dump_json(indent=2))
  ```
</CodeGroup>


## OpenAPI

````yaml openapi-specs/pro-api.json get /onchain/networks/{network_id}/tokens/{token_address}/top_traders
openapi: 3.0.0
info:
  title: CoinGecko Pro API
  version: 3.0.0
servers:
  - url: https://pro-api.coingecko.com/api/v3
security:
  - headerAuth: []
  - queryAuth: []
paths:
  /onchain/networks/{network_id}/tokens/{token_address}/top_traders:
    get:
      summary: Top Token Traders by Token Address
      description: >-
        To query top token traders based on the provided token contract address
        on a network
      operationId: top-token-traders-token-address
      parameters:
        - name: network_id
          in: path
          required: true
          description: |-
            Network ID. 
            *refers to [`/onchain/networks`](/reference/networks-list).
          schema:
            type: string
            default: solana
        - name: token_address
          in: path
          required: true
          description: Token contract address.
          schema:
            type: string
            default: Dfh5DzRgSvvCFDoYc2ciTkMrbDfRKybA4SoFbPmApump
        - name: traders
          in: query
          required: false
          description: |-
            Number of top token traders to return, any integer or `max`. 
            Default value: 10
          schema:
            type: string
        - name: sort
          in: query
          required: false
          description: |-
            Sort the traders by field. 
            Default: `realized_pnl_usd_desc`
          schema:
            type: string
            enum:
              - realized_pnl_usd_desc
              - unrealized_pnl_usd_desc
              - total_buy_usd_desc
              - total_sell_usd_desc
              - token_balance_desc
        - name: include_address_label
          in: query
          required: false
          description: |-
            Include address label data. 
            Default: `false`
          schema:
            type: boolean
      responses:
        '200':
          description: Top token traders data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopTokenTraders'
              example:
                data:
                  id: solana_Dfh5DzRgSvvCFDoYc2ciTkMrbDfRKybA4SoFbPmApump
                  type: top_trader
                  attributes:
                    traders:
                      - address: 9PHm2cYU8DhwBrbRsqqAjhW9uXVrNR1RaLsvo9oGVeaq
                        name: null
                        label: null
                        type: null
                        realized_pnl_usd: >-
                          31244842.94313992596882866680186718799091028666087696697895
                        unrealized_pnl_usd: null
                        token_balance: null
                        average_buy_price_usd: >-
                          0.107742029472092394285546782411629689178068069842295415369698476220071093
                        average_sell_price_usd: >-
                          0.185768700769238679578034408599493144222248390198249281897411569987021326
                        total_buy_count: 52433
                        total_sell_count: 110413
                        total_buy_token_amount: '270927018.63336'
                        total_sell_token_amount: '325324285.088228'
                        total_buy_usd: >-
                          29190226.8263815983907078691029715903175106331012100198765
                        total_sell_usd: >-
                          60435069.76952152435953653590483877830842091976208698685545
                        explorer_url: >-
                          https://solscan.io/account/9PHm2cYU8DhwBrbRsqqAjhW9uXVrNR1RaLsvo9oGVeaq
                      - address: EmDewJpfQaxWqxthX1FUyBCCPNGt8Ac5ek4M4pnGTgxC
                        name: null
                        label: null
                        type: null
                        realized_pnl_usd: >-
                          15905876.28067880560869831706113433929706359106197218605713
                        unrealized_pnl_usd: null
                        token_balance: null
                        average_buy_price_usd: >-
                          0.184253360370337436869211178097415145516564034725531545632817230594310635
                        average_sell_price_usd: >-
                          0.453961635984295417495686933363702788250069562233497749126971620666784823
                        total_buy_count: 17794
                        total_sell_count: 83977
                        total_buy_token_amount: '17256482.108901'
                        total_sell_token_amount: '42041969.15458'
                        total_buy_usd: >-
                          3179564.81673561651094979626153080521112057472898785000329
                        total_sell_usd: >-
                          19085441.09741442211964811332266514450818416579096003606042
                        explorer_url: >-
                          https://solscan.io/account/EmDewJpfQaxWqxthX1FUyBCCPNGt8Ac5ek4M4pnGTgxC
components:
  schemas:
    TopTokenTraders:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          required:
            - id
            - type
            - attributes
          properties:
            id:
              type: string
              description: Token identifier
            type:
              type: string
              description: Resource type
            attributes:
              type: object
              required:
                - traders
              properties:
                traders:
                  type: array
                  items:
                    type: object
                    required:
                      - address
                      - realized_pnl_usd
                      - unrealized_pnl_usd
                      - token_balance
                      - average_buy_price_usd
                      - average_sell_price_usd
                      - total_buy_count
                      - total_sell_count
                      - total_buy_token_amount
                      - total_sell_token_amount
                      - total_buy_usd
                      - total_sell_usd
                      - explorer_url
                    properties:
                      address:
                        type: string
                        description: Trader wallet address
                      name:
                        type: string
                        nullable: true
                        description: Address label name
                      label:
                        type: string
                        nullable: true
                        description: Address label
                      type:
                        type: string
                        nullable: true
                        description: Address type
                      realized_pnl_usd:
                        type: string
                        description: Realized PnL in USD
                      unrealized_pnl_usd:
                        type: string
                        nullable: true
                        description: Unrealized PnL in USD
                      token_balance:
                        type: string
                        nullable: true
                        description: Current token balance
                      average_buy_price_usd:
                        type: string
                        description: Average buy price in USD
                      average_sell_price_usd:
                        type: string
                        description: Average sell price in USD
                      total_buy_count:
                        type: integer
                        description: Total number of buy transactions
                      total_sell_count:
                        type: integer
                        description: Total number of sell transactions
                      total_buy_token_amount:
                        type: string
                        description: Total buy token amount
                      total_sell_token_amount:
                        type: string
                        description: Total sell token amount
                      total_buy_usd:
                        type: string
                        description: Total buy amount in USD
                      total_sell_usd:
                        type: string
                        description: Total sell amount in USD
                      explorer_url:
                        type: string
                        description: Block explorer URL for the trader address
  securitySchemes:
    headerAuth:
      type: apiKey
      in: header
      name: x-cg-pro-api-key
      description: >-
        Learn how to [set up your API
        key](https://docs.coingecko.com/docs/setting-up-your-api-key)
    queryAuth:
      type: apiKey
      in: query
      name: x_cg_pro_api_key
      description: >-
        Learn how to [set up your API
        key](https://docs.coingecko.com/docs/setting-up-your-api-key)

````