> ## Documentation Index
> Fetch the complete documentation index at: https://dune-pro-1110-add-delete-endpoints-python-js-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# dex.trades

> Description of the dex.trades table on Dune

export const TableSample = ({tableName, tableSchema}) => <div>
    <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6c1ea=${tableSchema}&table_name_t6c1ea=${tableName}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
  </div>;

export const ColumnDescriptions = ({tableName, tableSchema}) => <div>
    <iframe src={`https://dune.com/embeds/3424601/5785601?table_name_t6c1ea=${tableName}&table_schema_t6c1ea=${tableSchema}`} style={{
  width: "100%",
  height: "500px",
  border: "none",
  marginTop: "10px"
}} />
    <Info> Datatypes on Snowflake datashare are different in some cases, read more <a href="/datashare/datashare#datatypes">here</a>.  </Info>
  </div>;

The dex.trades table on Dune Analytics encapsulates the functional logic of recording and analyzing decentralized exchange (DEX) transactions. It serves as a foundational element for understanding the mechanics of trade execution, market dynamics, and participant behavior within the DeFi ecosystem.

## Usage

The `dex.trades` table is a valuable resource for understanding the dynamics of decentralized exchanges. It provides a comprehensive view of the trading activity, including the amount, price, side, and timestamp of each trade. Analysts can use this data to gain a deeper understanding of the market structure, trading behavior, dynamics on various decentralized exchanges.

## Coverage

The `dex.trades` table is maintained by Dune and its community of contributors. We try to make sure that the data is as accurate and up-to-date as possible. However, Dune does not guarantee the accuracy or completeness of the data provided. The table covers the following decentralized exchanges and their versions:

<div>
  <iframe src="https://dune.com/embeds/3453733/5803844/" width="100%" height="300px" frameBorder="0" scrolling="no" />
</div>

## Column Descriptions

<ColumnDescriptions tableSchema="dex" tableName="trades" />

## Table Sample

<TableSample tableSchema="dex" tableName="trades" />

## Example

The following query demonstrates how to use the dex.trades table to calculate the total volume of trades on a weekly basis.

```sql
SELECT
  blockchain,
  DATE_TRUNC('week', block_time),
  SUM(CAST(amount_usd AS DOUBLE)) AS usd_volume
FROM
  dex."trades" AS t
WHERE
 block_time > NOW() - INTERVAL '365' day
GROUP BY 1,2
```

<div>
  <iframe src="https://dune.com/embeds/2180075/3571504/" width="100%" height="300px" frameBorder="0" scrolling="no" />
</div>

For more examples of how to use the `dex.trades` table, check out the [DEX metrics dashboard](https://dune.com/hagaetc/dex-metrics).
