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

> ## Agent Instructions
> To query the Token Terminal data catalog, read https://tokenterminal.com/docs/catalog/agents-manual.md first. It is the whole catalog as one page: table naming grammar, key columns, partition and cluster rules, units, additivity, and the tables that are documented but not served yet.
> Never query a catalog table on a time bound alone. Also filter its cluster key, which you read from INFORMATION_SCHEMA.COLUMNS; an empty result means the object is a view, whose pruning contract is on its page. Compute is billed to the caller's own Google Cloud project.

# Trades

> Individual DEX swaps in token amounts.

One row per swap, in the pool's own token amounts. `amount_in` and `amount_out` are the two legs, and deduplicating a router's fills on `transaction_hash` turns venue volume into interface volume.

## Columns

<table>
  <thead>
    <tr>
      <th width="280">Column</th>
      <th width="130">Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>`block_timestamp`</td>
      <td>`TIMESTAMP`</td>
      <td>Time of the block containing the swap. Partition column.</td>
    </tr>

    <tr>
      <td>`transaction_hash`</td>
      <td>`STRING`</td>
      <td>Hash of the transaction containing the swap. Several rows share a hash when a router splits one swap across pools.</td>
    </tr>

    <tr>
      <td>`log_index`</td>
      <td>`INT64`</td>
      <td>Position of the swap event in the block. `(chain_id, transaction_hash, log_index)` identifies a row.</td>
    </tr>

    <tr>
      <td>`dex_pool_id`</td>
      <td>`STRING`</td>
      <td>Pool the swap executed in, keyed like [`dimensions.dex_pools`](https://tokenterminal.com/docs/catalog/dex/registry).</td>
    </tr>

    <tr>
      <td>`app_id`</td>
      <td>`STRING`</td>
      <td>The app operating the pool, read from the pool registry.</td>
    </tr>

    <tr>
      <td>`chain_id`</td>
      <td>`STRING`</td>
      <td>Chain the swap executed on.</td>
    </tr>

    <tr>
      <td>`project_id`</td>
      <td>`STRING`</td>
      <td>Project the operating app belongs to.</td>
    </tr>

    <tr>
      <td>`token_in_id`</td>
      <td>`STRING`</td>
      <td>Token the trader handed to the pool, keyed like [`dimensions.tokens`](https://tokenterminal.com/docs/catalog/tokens/registry).</td>
    </tr>

    <tr>
      <td>`token_out_id`</td>
      <td>`STRING`</td>
      <td>Token the trader received from the pool.</td>
    </tr>

    <tr>
      <td>`fee_rate`</td>
      <td>`BIGNUMERIC`</td>
      <td>Fee charged on this swap, as a decimal fraction of its size. Fixed per pool on most venues, set per swap where the venue supports dynamic fees. Null where the venue publishes no per-swap rate the catalog decodes (Aero, Aerodrome, Velodrome).</td>
    </tr>

    <tr>
      <td>`amount_in`</td>
      <td>`BIGNUMERIC`</td>
      <td>Amount of `token_in_id` handed over, in whole token units, always positive.</td>
    </tr>

    <tr>
      <td>`amount_out`</td>
      <td>`BIGNUMERIC`</td>
      <td>Amount of `token_out_id` received, in whole token units, always positive.</td>
    </tr>
  </tbody>
</table>

## Sample queries

> [!WARNING]
>
> This table is large and split by day. Bound `block_timestamp` and filter `chain_id` on every query, or you read the whole table and the whole table is billed to you.

**One day, one pool**

The pool here is the Uniswap v3 USDC-WETH 0.05% pool on Ethereum; find any pool's id in [`dimensions.dex_pools`](https://tokenterminal.com/docs/catalog/dex/registry).

```sql theme={null}
select
    trades.block_timestamp,
    trades.transaction_hash,
    trades.token_in_id,
    trades.amount_in,
    trades.token_out_id,
    trades.amount_out,
    trades.fee_rate
from `facts_dex_pools.trades` as trades
where trades.dex_pool_id = '0x88e6a0c2ddd26feeb64f039a2c41296fca843a45-ethereum'
  and trades.chain_id = 'ethereum'
  and trades.block_timestamp >= timestamp('2026-08-20')
  and trades.block_timestamp < timestamp('2026-08-21')
order by trades.amount_in desc
limit 100
```

**Venue vs interface volume**

The venue lens sums every fill; the interface lens counts each transaction once, taking its largest fill as the user's swap, so router-split swaps stop double counting.

```sql theme={null}
with fills as (
    select
        trades.transaction_hash,
        trades.amount_in
    from `facts_dex_pools.trades` as trades
    where trades.token_in_id = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48-ethereum'
      and trades.chain_id = 'ethereum'
      and trades.block_timestamp >= timestamp('2026-08-20')
      and trades.block_timestamp < timestamp('2026-08-21')
),

per_transaction as (
    select max(amount_in) as swap_amount
    from fills
    group by transaction_hash
)

select
    (select sum(amount_in) from fills) as venue_volume,
    (select sum(swap_amount) from per_transaction) as interface_volume
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.