MLDZMNOPvs8
Updated 2022-10-05Copy Reference Fork
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
34
›
⌄
with tb2 as (SELECT
BLOCK_TIMESTAMP::date as day,
count(distinct tx_hash) as swap_no,
count(distinct ORIGIN_FROM_ADDRESS) as swappers,
sum(AMOUNT_IN_USD) as volume,
volume/swap_no as average_volume
FROM optimism.velodrome.ez_swaps
where SYMBOL_IN='OP'
group by 1 having volume is not null
union all
SELECT
BLOCK_TIMESTAMP::date as day,
count(distinct tx_hash) as swap_no,
count(distinct ORIGIN_FROM_ADDRESS) as swappers,
sum(AMOUNT_IN_USD) as volume,
volume/swap_no as average_volume
FROM optimism.sushi.ez_swaps
where SYMBOL_IN='OP'
group by 1 having volume is not null),
tb3 as (select
date_trunc('day',HOUR) as day,
avg(price) as OP_price
from optimism.core.fact_hourly_token_prices
where SYMBOL='OP'
group by 1)
select
tb2.day as day,
swap_no,
volume,
average_volume,
OP_price
from tb2 join tb3 on tb2.day=tb3.day
Run a query to Download Data