Skip to content
Dune Analytics

@p0s / Tokenlon vs. DEX market by volume last 24 hours

Market share 🍰Tokenlon vs. DEX market by volume last 24 hours

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('hour', minute) as hour,                                                       
3            contract_address,                                                                          
4            avg(price) as price                                                                        
5    FROM prices.usd                                                                                    
6    WHERE minute > date_trunc('hour', now()) - interval '24 hours'                                                          
7    GROUP BY 1, 2                                                                                      
8)                                                                                                      
9SELECT  
10        CASE 
11            WHEN fee_recipient_address IN ('\x6f7ae872e995f98fcd2a7d3ba17b7ddfb884305f'::BYTEA,'\xb9e29984fe50602e7a619662ebed4f90d93824c7'::BYTEA) THEN 'Tokenlon'
12            WHEN project = '0x' THEN '0x (ex Tokenlon)'
13            ELSE project
14        END AS "Project",
15        date_trunc('hour', block_time),                                                                 
16        SUM(COALESCE(                                                                                  
17            usd_amount,                                                                                
18            token_a_amount * a.price,                                                                  
19            token_b_amount * b.price                                                                   
20        )) as usd_volume                                                                               
21FROM dex."trades" t                                                                                    
22LEFT JOIN prices a ON date_trunc('hour', block_time) = a.hour AND token_a_address = a.contract_address
23LEFT JOIN prices b ON date_trunc('hour', block_time) = b.hour AND token_b_address = b.contract_address
24LEFT JOIN zeroex.view_fills z ON t.tx_hash = z.transaction_hash AND z.fee_recipient_address IN ('\x6f7ae872e995f98fcd2a7d3ba17b7ddfb884305f'::BYTEA,'\xb9e29984fe50602e7a619662ebed4f90d93824c7'::BYTEA)
25WHERE block_time > date_trunc('hour', now()) - interval '24 hours'                                                          ...