sakineh5021-nIQRzBSushibar Servings 4
Updated 2022-04-19
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 inflow_xsushi as(
SELECT date_trunc('month', block_timestamp) as weekly
, sum(amount) as inflow
from ethereum.udm_events U
where weekly > '2021-01-01'
and to_address ='0x8798249c2e607446efb7ad49ec89dd1865ff4272'
group by 1
)
,
outflow_xsushi as(
SELECT date_trunc('month', block_timestamp) as weekly
, sum(amount) as OUtflo
from ethereum.udm_events U
where weekly > '2021-01-01'
and from_address ='0x8798249c2e607446efb7ad49ec89dd1865ff4272'
group by 1
)
, flow as(
SELECT I.weekly , inflow, -outflo as outflow , inflow-outflo as net_flow
from inflow_xsushi I , outflow_xsushi O
where I.weekly = O.weekly
) ,
price as (
SELECT date_trunc('month', hour) as weekly , max(price) as xsushi_price , min(price) as min_price
from ethereum.token_prices_hourly
where symbol = 'xSUSHI'
and weekly > '2021-01-01'
group by 1
)
SELECT P.weekly , xsushi_price as monthly_maximum_price , net_flow , min_price as monthly_minimum_price
from price P , flow F
where P.weekly = F.weekly
Run a query to Download Data