📇Indexer

📇 Indexer

Query Examples

This doc will teach you how to query TONCO analytics by writing GraphQL queries on the subgraph.

Explore

Explorer page: https://indexer.tonco.io

GraphQL endpoint: https://indexer.tonco.io

Global Data

An example querying total pool count, transaction count, and total volume in USD and TON for 2 days. Same way you can query historical data.

{
  dexData(from: 1733173200000, to: 1733259600000, groupBy: DAY) {
    poolCount
    txCount
    totalVolumeTon
    totalVolumeUsd
    totalValueLockedUsd
  }
}

Pool Data

To get data about a certain pool, pass in the pool address. Reference the full pool schema and adjust the query fields to retrieve the data points you want.

All Possible Pools

The query below returns the fee, spot price and liquidity for all pools

Specific Pool Query

The query below returns the fee, spot price and liquidity for the TON-USDT pool.

Most Liquid Pools

Retrieve the top 10 most liquid pools. You can use this similar set up to orderBy other variables.

Swap Data

General Swap Data

To query data about a particular swap, input the transaction hash

Recent Swaps Within a Pool

You can set the where field to filter swap data by pool address. This example fetches data about multiple swaps for the TON-USDT pool, ordered by time.

Jetton Data

Input the jetton contract address to fetch jetton data. Any jetton that exists in at least one TONCO pool can be queried. The output will aggregate data across all pools that include the jetton.

General Jetton Data

This queries the decimals, symbol, name and volume in USD for the USDT token.

Jetton Daily Aggregated

You can fetch aggregate data about a specific token over a 24-hour period. This query gets 10-days of the 24-hour volume data for the TONCO token ordered from oldest to newest.

All Jettons

Position Data

General Position Data

To get data about a specific position, input the NFT ID in the "tokenId:poolAddress" format. This queries the collected fees for token0 and token1 and current liquidity for the position with tokedId 502 in TON-USDT pool.