NavidCopy of Untitled Query
Updated 2022-12-12Copy 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
›
⌄
with prices as (
select
date(timestamp) as day,
token_contract,
symbol,
avg(price_usd) as priceusd
from
flow.core.fact_prices
group by
1,2,3
), daily as (
select
date_trunc('day', block_timestamp) as dayy,
sum(AMOUNT*priceusd) as "Volume (USD)",
avg("Volume (USD)") over (order by dayy asc rows between 7 preceding and current row) as "Moving Average"
from
flow.core.ez_token_transfers a join prices b on b.day=date_trunc('day', block_timestamp) and a.token_contract=b.token_contract
where
TX_SUCCEEDED and block_timestamp >= '2022-01-01'
group by 1
)
select
avg("Volume (USD)") as aver,
median("Volume (USD)") as medi,
min("Volume (USD)") as mini,
max("Volume (USD)") as maxi,
sum("Volume (USD)") as tot
from
daily
Run a query to Download Data