Learn to analyze daily DEX trading volumes across different blockchains
New to Dune? Let’s start your analytics journey by creating an insightful query that analyzes daily DEX trading volumes across different blockchains. This guide will teach you the basics while delivering practical insights about DeFi trading activity.
Create a New Query: Head over to Create New Query to begin. Dune uses DuneSQL, a SQL dialect that is compatible with TrinoSQL. It is a fairly vanilla SQL dialect, but there are some nuances you will eventually encounter. If you are not familiar with SQL, you can learn the basics here.
Choosing the right table is the first step to creating a successful query. You can find the table you need in the Data Catalog.
Understanding curated data: Instead of working with complex raw blockchain data, we’ll use Dune’s curated data - a collection of pre-built, analytics-ready tables. Curated data standardizes data across chains and makes analysis much easier.
The Perfect Table: For DEX trading analysis, we’ll use the dex.trades
table. This table contains standardized trading data across multiple DEXes and blockchains.
Let’s analyze DEX trading activity across different blockchains. We’ll start simple and build up our analysis:
Here’s our query:
Each part of this query helps us analyze DEX activity:
block_date
: Groups all trades into daily bucketsblockchain
: Helps us compare activity across Ethereum, Polygon, Arbitrum, etc.COUNT(*)
: Gives us the trading frequencySUM(amount_usd)
: Shows the total value traded in USDWHERE block_date >= NOW() - INTERVAL '30 days'
: Focuses on recent activityGROUP BY 1, 2, 3
: Combines trades by day, blockchain, and DEXORDER BY 1 DESC, 5 DESC
: Shows newest and highest volume trades firstWant to focus on your favorite DEX? Let’s add the column project
as a parameter to make the analysis interactive:
To add the parameter:
Now you can instantly switch between different DEXes to compare their performance!
After running your query, you can create powerful visualizations:
trading_day
trading_volume_usd
blockchain
This will create a stacked bar chart showing daily trading volumes by blockchain!
Want to explore more? Try:
Congratulations on creating your first DEX analysis query! 🎉
You can find many more queries related to DEX trading activity in this dashboard: DEX Trading Activity
Save your query by clicking Save in the upper right corner. You can revisit and modify it anytime to explore different aspects of DEX trading activity.
Ready to create more advanced queries? Check out our other guides to learn more about Dune
Learn to analyze daily DEX trading volumes across different blockchains
New to Dune? Let’s start your analytics journey by creating an insightful query that analyzes daily DEX trading volumes across different blockchains. This guide will teach you the basics while delivering practical insights about DeFi trading activity.
Create a New Query: Head over to Create New Query to begin. Dune uses DuneSQL, a SQL dialect that is compatible with TrinoSQL. It is a fairly vanilla SQL dialect, but there are some nuances you will eventually encounter. If you are not familiar with SQL, you can learn the basics here.
Choosing the right table is the first step to creating a successful query. You can find the table you need in the Data Catalog.
Understanding curated data: Instead of working with complex raw blockchain data, we’ll use Dune’s curated data - a collection of pre-built, analytics-ready tables. Curated data standardizes data across chains and makes analysis much easier.
The Perfect Table: For DEX trading analysis, we’ll use the dex.trades
table. This table contains standardized trading data across multiple DEXes and blockchains.
Let’s analyze DEX trading activity across different blockchains. We’ll start simple and build up our analysis:
Here’s our query:
Each part of this query helps us analyze DEX activity:
block_date
: Groups all trades into daily bucketsblockchain
: Helps us compare activity across Ethereum, Polygon, Arbitrum, etc.COUNT(*)
: Gives us the trading frequencySUM(amount_usd)
: Shows the total value traded in USDWHERE block_date >= NOW() - INTERVAL '30 days'
: Focuses on recent activityGROUP BY 1, 2, 3
: Combines trades by day, blockchain, and DEXORDER BY 1 DESC, 5 DESC
: Shows newest and highest volume trades firstWant to focus on your favorite DEX? Let’s add the column project
as a parameter to make the analysis interactive:
To add the parameter:
Now you can instantly switch between different DEXes to compare their performance!
After running your query, you can create powerful visualizations:
trading_day
trading_volume_usd
blockchain
This will create a stacked bar chart showing daily trading volumes by blockchain!
Want to explore more? Try:
Congratulations on creating your first DEX analysis query! 🎉
You can find many more queries related to DEX trading activity in this dashboard: DEX Trading Activity
Save your query by clicking Save in the upper right corner. You can revisit and modify it anytime to explore different aspects of DEX trading activity.
Ready to create more advanced queries? Check out our other guides to learn more about Dune