Skip to content
Dune Analytics

@p0s / DEX category volume over the last 2 years

Market share 🍰DEX category volume over the last 2 years

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 results

Loading
 

SQL query

1WITH prices AS (                                                                                       
2    SELECT  date_trunc('month', minute) as month,                                                       
3            contract_address,                                                                          
4            avg(price) as price                                                                        
5    FROM prices.usd                                                                                    
6    WHERE minute > date_trunc('month', now()) - interval '24 months'                                                          
7    GROUP BY 1, 2                                                                                      
8)                                                                                                      
9SELECT  
10    CASE  
11        WHEN project IN ('Uniswap', 'Curve', 'Balancer', 'Bancor Network') THEN 'AMM'
12        WHEN project IN ('dYdX', 'Synthetix') THEN 'Synthetics'
13        WHEN project IN ('Gnosis Protocol') THEN 'Other'
14        WHEN project IN ('Oasis', 'Loopring', 'IDEX', 'DDEX') THEN 'Orderbook'
15        WHEN project IN ('0x', 'Kyber') THEN 'Aggregator'
16        WHEN fee_recipient_address IN ('\x6f7ae872e995f98fcd2a7d3ba17b7ddfb884305f'::BYTEA,'\xb9e29984fe50602e7a619662ebed4f90d93824c7'::BYTEA) THEN 'RFQ'
17        ELSE 'NA' 
18    END as "Project", 
19    date_trunc('month', block_time),                                                                 
20    SUM(COALESCE(                                                                                  
21        usd_amount,                                                                                
22        token_a_amount * a.price,                                                                  
23        token_b_amount * b.price                                                                   
24    )) as usd_volume                                                                               
25FROM dex."trades" t                                                                                    ...