Ali3NAverage Daily Transactions Volume Arbitrum vs Optimism
Updated 2023-02-24
999
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
34
35
36
›
⌄
with timetable as (
select case when '{{Time_Frame}}' = 'Last 30 Days' then 30
when '{{Time_Frame}}' = 'Last 60 Days' then 60
when '{{Time_Frame}}' = 'Last 90 Days' then 90
when '{{Time_Frame}}' = 'Last 180 Days' then 180
when '{{Time_Frame}}' = 'Last 365 Days' then 365
when '{{Time_Frame}}' = 'All Time' then 2000
else 2000 end as timeFrame),
pricet as (
select block_timestamp::date as day,
token_in,
decimals,
avg (amount_out_usd/amount_in_usd) as USDPrice
from arbitrum.sushi.ez_swaps t1 join arbitrum.core.dim_contracts t2 on token_in = address
join timetable
where token_out in ('0xdac17f958d2ee523a2206206994597c13d831ec7','0x94b008aa00579c1307b0ef2c499ad98a8ce58e58','0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9','0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48','0x7f5c764cbc14f9669b88837ca1490cca17c31607','0xff970a61a04b1ca14834a43f5de4533ebddb5cc8') --usdt,usdc
and amount_in_usd > 0
and amount_out_usd > 0
and block_timestamp::date >= current_date - timeFrame
group by 1,2,3
union ALL
select block_timestamp::date as day,
token_in,
decimals,
avg (amount_out_usd/amount_in_usd) as USDPrice
from optimism.sushi.ez_swaps t1 join optimism.core.dim_contracts t2 on token_in = address
join timetable
where token_out in ('0xdac17f958d2ee523a2206206994597c13d831ec7','0x94b008aa00579c1307b0ef2c499ad98a8ce58e58','0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9','0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48','0x7f5c764cbc14f9669b88837ca1490cca17c31607','0xff970a61a04b1ca14834a43f5de4533ebddb5cc8') --usdt,usdc
and amount_in_usd > 0
and amount_out_usd > 0
and block_timestamp::date >= current_date - timeFrame
group by 1,2,3),
Run a query to Download Data