Moefffllllwww9
Updated 2023-01-11Copy 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 prices as (select date(RECORDED_HOUR) date ,
avg(CLOSE) as price
from
crosschain.core.fact_hourly_prices
where
ID ilike 'flow'
and
RECORDED_HOUR between '2022-12-01' and CURRENT_DATE -1
group by 1
)
select
'Flow out' as type ,
monthname(BLOCK_TIMESTAMP) AS Month,
sum(TOKEN_OUT_AMOUNT*price) AS Volume,
avg(TOKEN_OUT_AMOUNT*price) AS avg_Volume,
count(distinct TRADER) as TRADERs,
Volume/TRADERs as volume_per_trader,
volume/count(distinct block_timestamp::date) as vol_per_day
from flow.core.ez_swaps s , prices p
where TOKEN_OUT_CONTRACT ilike '%Flow%'
and block_timestamp::date = date
group by 2
union all
select
'Flow in' as type ,
monthname(BLOCK_TIMESTAMP) AS Month,
sum(TOKEN_IN_AMOUNT*price) AS Volume,
avg(TOKEN_IN_AMOUNT*price) AS avg_Volume,
count(distinct TRADER) as TRADERs,
Volume/TRADERs as volume_per_trader,
volume/count(distinct block_timestamp::date) as vol_per_day
Run a query to Download Data