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

# OHLC & Statistics

> Query examples for K-line data (Pairs), per-token trade statistics (Tokens), supply and valuation (TokenSupplyUpdates), and where to find token metadata

This page covers aggregated trading and supply data. The **cube names** are **Pairs** and **Tokens** in the **Trading** chain group (cross-chain OHLC and trade stats). Market cap and price snapshots over time come from **TokenSupplyUpdates** under **Solana** or **EVM**.

* **Pairs** (Trading, DWM) — per-minute candlestick / K-line data (OHLC, volume, trade count)
* **Tokens** (Trading, DWM) — per-minute trade statistics with buy/sell breakdown and unique traders
* **TokenSupplyUpdates** (Solana / EVM, DWD) — mint/burn events with supply, price, market cap, and FDV fields
* **Token metadata** — there is no separate **TokenSearch** cube; use **Token** (and related) dimensions on **Pairs** / **Tokens**, or other cubes such as **DEXPools**, **TokenHolders**, and **DEXTradeByTokens** for discovery and screening

<Note>
  **Trading** has **no** `network` argument. Filter by chain with `where: { Market: { Network: { is: "sol" } } }` (or `eth`, `bsc`, `polygon`). **Solana** and **EVM** groups use their usual wrappers (`Solana { ... }`, `EVM(network: eth) { ... }`).
</Note>

***

## How do I get K-line (OHLC) candlestick data?

Fetch candlestick data for a token — open, high, low, close prices per minute, plus USD volume and trade count. Use the **Pairs** cube inside **Trading**.

```graphql theme={null}
query {
  Trading {
    Pairs(
      tokenAddress: { is: "TOKEN_ADDRESS" }
      where: { Market: { Network: { is: "sol" } } }
      limit: { count: 24 }
      orderBy: { descending: Block_Time }
    ) {
      Interval { Time { Start } }
      Token { Address }
      Market { Network }
      Price {
        Ohlc {
          Open
          High
          Low
          Close
        }
      }
      Volume { Usd }
      Stats { TradeCount }
    }
  }
}
```

<Tip>
  [Open in GraphQL IDE](https://ide.chainstream.io) — paste the query above to run it interactively with auto-complete and schema exploration.
</Tip>

<Tip>
  Replace `TOKEN_ADDRESS` with the token mint or contract address. Each row is one minute bucket — use `limit: { count: 60 }` for about one hour, `count: 1440` for about 24 hours. Omit the `Market` filter to query across all chains in one result set.
</Tip>

<AccordionGroup>
  <Accordion title="Key fields">
    | Field                 | Description                               |
    | :-------------------- | :---------------------------------------- |
    | `Interval.Time.Start` | Minute-bucket start (same as candle time) |
    | `Token.Address`       | Token address                             |
    | `Market.Network`      | Chain identifier (`sol`, `eth`, `bsc`, …) |
    | `Price.Ohlc.Open`     | Opening price for the interval            |
    | `Price.Ohlc.High`     | Highest price during the interval         |
    | `Price.Ohlc.Low`      | Lowest price during the interval          |
    | `Price.Ohlc.Close`    | Closing price for the interval            |
    | `Volume.Usd`          | Total USD volume in this interval         |
    | `Stats.TradeCount`    | Number of trades in this interval         |
  </Accordion>

  <Accordion title="Customization tips">
    * **Longer timeframes**: Request more rows with `limit`, or aggregate client-side; candles are stored at minute granularity
    * **Volume filter**: e.g. `where: { Volume: { Usd: { gt: 100 } }, Market: { Network: { is: "sol" } } }` to skip low-volume intervals
    * **Time range**: e.g. `where: { Block: { Time: { since: "2026-03-27T00:00:00Z" } }, Market: { Network: { is: "sol" } } }`
  </Accordion>
</AccordionGroup>

<Info>
  The **Pairs** cube is a **DWM** (aggregated) model — data is pre-computed per minute. It is much faster than scanning raw trades for chart data.
</Info>

***

## How do I get trade statistics for a token?

Get per-minute trade statistics with buy/sell counts, unique buyer/seller counts, and volume. Use the **Tokens** cube inside **Trading**.

```graphql theme={null}
query {
  Trading {
    Tokens(
      tokenAddress: { is: "TOKEN_ADDRESS" }
      where: { Market: { Network: { is: "sol" } } }
      limit: { count: 24 }
      orderBy: { descending: Block_Time }
    ) {
      Interval { Time { Start } }
      Token { Address }
      Market { Network }
      Stats {
        TradeCount
        BuyCount
        SellCount
        UniqueBuyers
        UniqueSellers
      }
      Volume { Usd }
    }
  }
}
```

<AccordionGroup>
  <Accordion title="Key fields">
    | Field                 | Description                               |
    | :-------------------- | :---------------------------------------- |
    | `Interval.Time.Start` | Minute-bucket start (same as candle time) |
    | `Stats.TradeCount`    | Total trades in this interval             |
    | `Stats.BuyCount`      | Buy-side trades                           |
    | `Stats.SellCount`     | Sell-side trades                          |
    | `Volume.Usd`          | Total USD volume                          |
    | `Stats.UniqueBuyers`  | Distinct buyer wallets                    |
    | `Stats.UniqueSellers` | Distinct seller wallets                   |
  </Accordion>

  <Accordion title="Customization tips">
    * **Buy/sell pressure**: Compare `Stats.BuyCount` vs `Stats.SellCount`
    * **Unique traders**: `Stats.UniqueBuyers` and `Stats.UniqueSellers` show whether volume is broad or concentrated
    * **Activity heatmap**: Query a full day (`count: 1440`) and chart by `Interval.Time.Start` (or `Block.Time`)
    * **Buy/sell volume**: The **Tokens** record also exposes `Volume.BuyVolumeUSD` and `Volume.SellVolumeUSD` when you need USD split
  </Accordion>
</AccordionGroup>

<Tip>
  Combine **Pairs** and **Tokens** for the same token, chain, and time window to build dashboards — OHLC alongside flow and participant metrics.
</Tip>

***

## How do I get market cap, price, and supply over time?

The legacy **TokenMarketCap** summary cube is not used in the current schema. Use **TokenSupplyUpdates** (Solana or EVM): each row reflects a supply-affecting event with **TokenSupplyUpdate** metrics including price, market cap, FDV, and total supply.

### Solana

```graphql theme={null}
query {
  Solana {
    TokenSupplyUpdates(
      tokenAddress: { is: "TOKEN_ADDRESS" }
      limit: { count: 24 }
      orderBy: { descending: Block_Time }
    ) {
      Block { Time }
      TokenSupplyUpdate {
        Currency {
          MintAddress
          Decimals
          Symbol
          Name
        }
        PriceInUSD
        MarketCapInUSD
        TotalSupply
        FDVInUSD
        PostBalance
      }
      Transaction { Signature }
    }
  }
}
```

### EVM (Ethereum example)

```graphql theme={null}
query {
  EVM(network: eth) {
    TokenSupplyUpdates(
      tokenAddress: { is: "TOKEN_ADDRESS" }
      limit: { count: 24 }
      orderBy: { descending: Block_Time }
    ) {
      Block { Time }
      TokenSupplyUpdate {
        Currency {
          MintAddress
          Decimals
          Symbol
          Name
        }
        PriceInUSD
        MarketCapInUSD
        TotalSupply
        FDVInUSD
        PostBalance
      }
      Transaction { Hash }
    }
  }
}
```

<AccordionGroup>
  <Accordion title="Key fields">
    | Field                              | Description                                            |
    | :--------------------------------- | :----------------------------------------------------- |
    | `Block.Time`                       | Event time                                             |
    | `TokenSupplyUpdate.Currency.*`     | Token identity (mint/contract, decimals, symbol, name) |
    | `TokenSupplyUpdate.PriceInUSD`     | Price in USD at this update                            |
    | `TokenSupplyUpdate.MarketCapInUSD` | Market capitalization                                  |
    | `TokenSupplyUpdate.TotalSupply`    | Total supply                                           |
    | `TokenSupplyUpdate.FDVInUSD`       | Fully diluted valuation                                |
    | `TokenSupplyUpdate.PostBalance`    | Supply-related balance after the event                 |
  </Accordion>

  <Accordion title="Customization tips">
    * **Latest snapshot**: `limit: { count: 1 }` with `orderBy: { descending: Block_Time }`
    * **Compare chains**: Run the same shape under `Solana` and `EVM(network: bsc)` (or other supported networks)
    * **More context**: See also [Pools & Liquidity](/en/graphql/examples/pools-liquidity#how-do-i-get-token-supply-and-market-cap) for supply and pool-related examples
  </Accordion>
</AccordionGroup>

<Info>
  **TokenSupplyUpdates** is **DWD** (event-level). It is the right place for historical valuation and supply changes tied to mint/burn activity, rather than a single static “market cap” summary row.
</Info>

***

## Where is token search / metadata?

The **TokenSearch** cube is **not** part of the current API. For token context:

* **Pairs** and **Tokens** expose **Token** dimensions (e.g. **Token.Address**) alongside OHLC and stats — use them when you already know the address and want aggregated trading data.
* For richer metadata, holder counts, pools, or discovery, use cubes such as **DEXPools**, **TokenHolders**, or **DEXTradeByTokens** under **Solana** or **EVM**, depending on your chain.

***

## Multi-Chain Examples

<Tabs>
  <Tab title="Solana (Trading)">
    ```graphql theme={null}
    query {
      Trading {
        Pairs(
          tokenAddress: { is: "TOKEN_ADDRESS" }
          where: { Market: { Network: { is: "sol" } } }
          limit: { count: 10 }
          orderBy: { descending: Block_Time }
        ) {
          Interval { Time { Start } }
          Price {
            Ohlc {
              Open
              Close
            }
          }
          Volume { Usd }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Ethereum (Trading)">
    ```graphql theme={null}
    query {
      Trading {
        Pairs(
          tokenAddress: { is: "TOKEN_ADDRESS" }
          where: { Market: { Network: { is: "eth" } } }
          limit: { count: 10 }
          orderBy: { descending: Block_Time }
        ) {
          Interval { Time { Start } }
          Price {
            Ohlc {
              Open
              Close
            }
          }
          Volume { Usd }
        }
      }
    }
    ```
  </Tab>

  <Tab title="BSC (Trading)">
    ```graphql theme={null}
    query {
      Trading {
        Pairs(
          tokenAddress: { is: "TOKEN_ADDRESS" }
          where: { Market: { Network: { is: "bsc" } } }
          limit: { count: 10 }
          orderBy: { descending: Block_Time }
        ) {
          Interval { Time { Start } }
          Price {
            Ohlc {
              Open
              Close
            }
          }
          Volume { Usd }
        }
      }
    }
    ```
  </Tab>
</Tabs>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="DEX Trades" icon="arrow-right-arrow-left" href="/en/graphql/examples/dex-trades">
    Query DEX trading data — token trades, wallet activity, and top traders.
  </Card>

  <Card title="Transfers" icon="paper-plane" href="/en/graphql/examples/transfers">
    Track on-chain token transfers between wallets.
  </Card>

  <Card title="Balances & Holders" icon="wallet" href="/en/graphql/examples/balance-holders">
    Look up wallet balances, balance history, and top holders.
  </Card>

  <Card title="Pools & Liquidity" icon="droplet" href="/en/graphql/examples/pools-liquidity">
    Explore DEX pool and liquidity data.
  </Card>
</CardGroup>
