AzinOptimism4
Updated 2022-12-20Copy 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
35
36
›
⌄
with t1 as
(select
sum(case when SYMBOL_IN='OP' then AMOUNT_IN else null end) as inflow,
sum(case when SYMBOL_OUT='OP' then AMOUNT_OUT else null end) as outflow,
inflow-outflow as netflow ,
date_trunc(day,BLOCK_TIMESTAMP) as date
from optimism.sushi.ez_swaps
group by date)
,
t2 as
(select
sum(netflow) over (order by date) as net_flow , *
from t1),
price as
(
select
avg (case when ID='optimism' then CLOSE else null end ) as price,
date_trunc(day,RECORDED_HOUR) as datee
from
crosschain.core.fact_hourly_prices
group by datee
)
select * from t2 a left join price b
Run a query to Download Data