misaghlbUser Behavior (redux) - swaps
Updated 2022-10-26
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
›
⌄
select date(s.block_timestamp) as date,
count(distinct s.tx_hash) as tx_count,
count(distinct from_address) as wallets,
sum(tx_fee * p.price) as usd_vol,
avg(tx_fee * p.price) as avg_usd_vol,
sum(tx_count) over (order by date) as cumu_tx_count,
sum(usd_vol) over (order by date) as cumu_usd_vol,
'Optimism' as blockchain
from optimism.sushi.ez_swaps s join ethereum.core.fact_hourly_token_prices p on date_trunc('hour', s.block_timestamp) = p.hour and symbol = 'WETH'
join optimism.core.fact_transactions t on t.tx_hash = s.tx_hash
where status = 'SUCCESS'
and date(s.block_timestamp) >= CURRENT_DATE - 30
GROUP BY date
union all
select date(s.block_timestamp) as date,
count(distinct s.tx_hash) as tx_count,
count(distinct from_address) as wallets,
sum(tx_fee * p.price) as usd_vol,
avg(tx_fee * p.price) as avg_usd_vol,
sum(tx_count) over (order by date) as cumu_tx_count,
sum(usd_vol) over (order by date) as cumu_usd_vol,
'Ethereum' as blockchain
from ethereum.sushi.ez_swaps s join ethereum.core.fact_hourly_token_prices p on date_trunc('hour', s.block_timestamp) = p.hour and symbol = 'WETH'
join ethereum.core.fact_transactions t on t.tx_hash = s.tx_hash
where status = 'SUCCESS'
and date(s.block_timestamp) >= CURRENT_DATE - 30
GROUP BY date
Run a query to Download Data