> ## 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 및 통계

> K라인 데이터(Pairs), 토큰별 거래 통계(Tokens), 공급 및 평가(TokenSupplyUpdates)에 대한 쿼리 예제와 토큰 메타데이터 위치

이 페이지는 집계된 거래 및 공급 데이터를 다룹니다. **Cube 이름**은 **Trading** chain group의 **Pairs**와 **Tokens**(크로스체인 OHLC 및 거래 통계)입니다. 시가총액과 가격 스냅샷은 시간에 따라 **Solana** 또는 **EVM** 아래 **TokenSupplyUpdates**에서 가져옵니다.

* **Pairs** (Trading, DWM) — 분 단위 캔들 / K-line 데이터 (OHLC, 거래량, 거래 건수)
* **Tokens** (Trading, DWM) — 매수/매도 분해 및 고유 트레이더가 포함된 분 단위 거래 통계
* **TokenSupplyUpdates** (Solana / EVM, DWD) — 공급, 가격, 시가총액, FDV 필드가 있는 mint/burn 이벤트
* **토큰 메타데이터** — 별도 **TokenSearch** Cube는 없습니다. **Pairs** / **Tokens**의 **Token**(및 관련) dimension을 쓰거나, **DEXPools**, **TokenHolders**, **DEXTradeByTokens** 등 다른 Cube로 탐색·스크리닝하세요

<Note>
  **Trading**에는 `network` 인자가 **없습니다**. 체인은 `where: { Market: { Network: { is: "sol" } } }`처럼 필터합니다 (`eth`, `bsc`, `polygon` 등). **Solana**와 **EVM** 그룹은 기존 래퍼(`Solana { ... }`, `EVM(network: eth) { ... }`)를 그대로 사용합니다.
</Note>

***

## K-line(OHLC) 캔들 데이터는 어떻게 가져오나요?

토큰의 캔들 데이터 — 분당 시가·고가·저가·종가, USD 거래량 및 거래 건수 — 를 조회합니다. **Trading** 안의 **Pairs** Cube를 사용합니다.

```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>
  [GraphQL IDE에서 열기](https://ide.chainstream.io) — 위 쿼리를 붙여 넣어 자동 완성과 스키마 탐색으로 대화형 실행할 수 있습니다.
</Tip>

<Tip>
  `TOKEN_ADDRESS`를 토큰 mint 또는 컨트랙트 주소로 바꾸세요. 각 행은 1분 버킷입니다 — 약 1시간은 `limit: { count: 60 }`, 약 24시간은 `count: 1440`을 사용하세요. `Market` 필터를 생략하면 한 결과 집합에서 모든 체인을 조회할 수 있습니다.
</Tip>

<AccordionGroup>
  <Accordion title="주요 필드">
    | 필드                    | 설명                              |
    | :-------------------- | :------------------------------ |
    | `Interval.Time.Start` | 분 버킷 시작(캔들 시각과 동일)              |
    | `Token.Address`       | 토큰 주소                           |
    | `Market.Network`      | 체인 식별자 (`sol`, `eth`, `bsc`, …) |
    | `Price.Ohlc.Open`     | 구간 시가                           |
    | `Price.Ohlc.High`     | 구간 고가                           |
    | `Price.Ohlc.Low`      | 구간 저가                           |
    | `Price.Ohlc.Close`    | 구간 종가                           |
    | `Volume.Usd`          | 해당 구간 USD 거래량 합계                |
    | `Stats.TradeCount`    | 해당 구간 거래 건수                     |
  </Accordion>

  <Accordion title="커스터마이징 팁">
    * **더 긴 기간**: `limit`으로 더 많은 행을 요청하거나 클라이언트에서 집계합니다. 캔들은 분 단위로 저장됩니다.
    * **거래량 필터**: 예) `where: { Volume: { Usd: { gt: 100 } }, Market: { Network: { is: "sol" } } }`로 저거래량 구간 제외
    * **시간 범위**: 예) `where: { Block: { Time: { since: "2026-03-27T00:00:00Z" } }, Market: { Network: { is: "sol" } } }`
  </Accordion>
</AccordionGroup>

<Info>
  **Pairs** Cube는 **DWM**(집계) 모델입니다 — 데이터가 분 단위로 미리 계산됩니다. 차트용으로 raw 거래를 스캔하는 것보다 훨씬 빠릅니다.
</Info>

***

## 토큰별 거래 통계는 어떻게 가져오나요?

매수/매도 건수, 고유 매수자/매도자 수, 거래량이 포함된 분 단위 거래 통계를 가져옵니다. **Trading** 안의 **Tokens** Cube를 사용합니다.

```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="주요 필드">
    | 필드                    | 설명                 |
    | :-------------------- | :----------------- |
    | `Interval.Time.Start` | 분 버킷 시작(캔들 시각과 동일) |
    | `Stats.TradeCount`    | 해당 구간 총 거래 수       |
    | `Stats.BuyCount`      | 매수 쪽 거래            |
    | `Stats.SellCount`     | 매도 쪽 거래            |
    | `Volume.Usd`          | 총 USD 거래량          |
    | `Stats.UniqueBuyers`  | 서로 다른 매수 지갑 수      |
    | `Stats.UniqueSellers` | 서로 다른 매도 지갑 수      |
  </Accordion>

  <Accordion title="커스터마이징 팁">
    * **매수/매도 압력**: `Stats.BuyCount`와 `Stats.SellCount` 비교
    * **고유 트레이더**: `Stats.UniqueBuyers`와 `Stats.UniqueSellers`로 거래량이 넓게 퍼졌는지 집중됐는지 확인
    * **활동 히트맵**: 하루 전체(`count: 1440`)를 조회해 `Interval.Time.Start`(또는 `Block.Time`) 기준으로 차트
    * **매수/매도 거래량**: USD 분해가 필요하면 **Tokens** 레코드의 `Volume.BuyVolumeUSD`, `Volume.SellVolumeUSD` 사용
  </Accordion>
</AccordionGroup>

<Tip>
  같은 토큰·체인·시간 창에 대해 **Pairs**와 **Tokens**를 함께 쓰면 대시보드를 만들 수 있습니다 — OHLC와 유동·참여자 지표를 나란히 표시합니다.
</Tip>

***

## 시가총액, 가격, 공급을 시간에 따라 어떻게 가져오나요?

레거시 **TokenMarketCap** 요약 Cube는 현재 스키마에서 사용하지 않습니다. **TokenSupplyUpdates**(Solana 또는 EVM)를 사용하세요. 각 행은 공급에 영향을 주는 이벤트를 반영하며, 가격·시가총액·FDV·총 공급을 포함하는 **TokenSupplyUpdate** 지표가 있습니다.

### 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 예시)

```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="주요 필드">
    | 필드                                 | 설명                                       |
    | :--------------------------------- | :--------------------------------------- |
    | `Block.Time`                       | 이벤트 시각                                   |
    | `TokenSupplyUpdate.Currency.*`     | 토큰 식별(mint/컨트랙트, decimals, symbol, name) |
    | `TokenSupplyUpdate.PriceInUSD`     | 해당 업데이트 시점 USD 가격                        |
    | `TokenSupplyUpdate.MarketCapInUSD` | 시가총액                                     |
    | `TokenSupplyUpdate.TotalSupply`    | 총 공급량                                    |
    | `TokenSupplyUpdate.FDVInUSD`       | 완전 희석 가치(FDV)                            |
    | `TokenSupplyUpdate.PostBalance`    | 이벤트 이후 공급 관련 잔액                          |
  </Accordion>

  <Accordion title="커스터마이징 팁">
    * **최신 스냅샷**: `orderBy: { descending: Block_Time }`와 `limit: { count: 1 }`
    * **체인 비교**: `Solana`와 `EVM(network: bsc)`(또는 지원 네트워크)에서 동일한 쿼리 형태 실행
    * **추가 맥락**: 공급 및 풀 관련 예시는 [Pools & Liquidity](/ko/graphql/examples/pools-liquidity#how-do-i-get-token-supply-and-market-cap)도 참고하세요
  </Accordion>
</AccordionGroup>

<Info>
  **TokenSupplyUpdates**는 **DWD**(이벤트 수준)입니다. 단일 정적 “시가총액” 요약 행이 아니라, mint/burn 활동과 연계된 역사적 밸류에이션·공급 변화를 보기에 적합합니다.
</Info>

***

## 토큰 검색 / 메타데이터는 어디에 있나요?

**TokenSearch** Cube는 현재 API에 **포함되어 있지 않습니다**. 토큰 맥락이 필요하면:

* **Pairs**와 **Tokens**는 OHLC·통계와 함께 **Token** dimension(예: **Token.Address**)을 노출합니다 — 주소를 이미 알고 집계 거래 데이터가 필요할 때 사용하세요.
* 메타데이터·홀더 수·풀·탐색이 더 필요하면 **Solana** 또는 **EVM** 아래 **DEXPools**, **TokenHolders**, **DEXTradeByTokens** 등 Cube를 체인에 맞게 사용하세요.

***

## 멀티체인 예시

<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>

***

## 다음 단계

<CardGroup cols={2}>
  <Card title="DEX Trades" icon="arrow-right-arrow-left" href="/ko/graphql/examples/dex-trades">
    DEX 거래 데이터 조회 — 토큰 거래, 지갑 활동, 상위 트레이더.
  </Card>

  <Card title="Transfers" icon="paper-plane" href="/ko/graphql/examples/transfers">
    지갑 간 온체인 토큰 전송 추적.
  </Card>

  <Card title="Balances & Holders" icon="wallet" href="/ko/graphql/examples/balance-holders">
    지갑 잔액, 잔액 이력, 상위 홀더 조회.
  </Card>

  <Card title="Pools & Liquidity" icon="droplet" href="/ko/graphql/examples/pools-liquidity">
    DEX 풀 및 유동성 데이터 탐색.
  </Card>
</CardGroup>
