Skip to content
Dune Analytics

@kroeger0x / Largest DEX Trades

Largest DEX Trades

Loading
 

About queries and results

Dune Analytics lets you explore, create, and share Ethereum analytics. You can find an endless amount of great queries and dashboards on Dune.

We have decoded Ethereum smart contract data so you can do powerful analysis with simple SQL queries and visualise the query results into beautiful graphs.

Dune Analytics is free for everyone forever. If you want extra features like private queries, export your results and more check out our Pro plan.

SQL query

1WITH prices AS (                                                                                       
2    SELECT minute,                                                         
3        contract_address,                                                                              
4        price
5    FROM prices.usd                                                                                    
6    WHERE minute > now() - interval '700 days'
7)                                                                                                      
8select
9    t.project
10    , t.tx_hash
11    , CASE
12        WHEN token_a_address = a.contract_address THEN token_a_amount * a.price -- Use token A when there's USD price for it                    
13        ELSE token_b_amount * b.price -- Else use token b                             
14    END AS usd_volume
15FROM dex."trades" t                                                                             
16LEFT JOIN prices a ON date_trunc('minute', block_time) = a.minute AND token_a_address = a.contract_address 
17LEFT JOIN prices b ON date_trunc('minute', block_time) = b.minute AND token_b_address = b.contract_address 
18WHERE block_time > now() - interval '700 days'
19ORDER BY 3 DESC NULLS LAST
20LIMIT 100;
21

SQL query results

Loading