elenahooUniswap v2 vs. v3 daily volume
Updated 2022-01-25
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
›
⌄
with v2_vol as (
select date_trunc('day',block_timestamp) as date
--, pool_address
--, pool_name
, sum(amount_usd) as v2_volume
, avg(amount_usd) as avg_v2_volume
from ethereum.dex_swaps
where platform like '%uniswap-v2%'
and date > date_trunc('month',current_date) - interval '6 Month'
group by 1
order by 1
),
v3_vol as (
select date_trunc('day',block_timestamp) as date
--, pool_address
--, pool_name
, sum(amount_usd) as v3_volume
, avg(amount_usd) as avg_v3_volume
from ethereum.dex_swaps
where platform like '%uniswap-v3%'
and date > date_trunc('month',current_date) - interval '6 Month'
group by 1
order by 1
)
select v2_vol.*
, v3_vol.v3_volume
, v3_vol.avg_v3_volume
, v2_vol.v2_volume - v3_vol.v3_volume as volume_difference
, v2_vol.avg_v2_volume - v3_vol.avg_v3_volume as avg_volume_difference
from v2_vol
inner join v3_vol on v2_vol.date = v3_vol.date
order by v2_vol.date
Run a query to Download Data