misaghlbDeFi on Flow - transfer
Updated 2022-11-20Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
›
⌄
with prices as(
select date(timestamp) as pdate, token, symbol, token_contract as token_address, avg(price_usd) as avg_price
from flow.core.fact_prices
where token != 'Blocto'
group by pdate, token, symbol, token_contract
)
select date_trunc('week', block_timestamp) as date, symbol,
count(distinct tx_id) as transfers,
count(distinct sender) as senders,
count(distinct recipient) as receivers,
sum(amount*avg_price) as usd_vol,
avg(amount*avg_price) as avg_usd_vol,
sum(transfers) over(partition by symbol order by date) as cumu_transfers,
sum(usd_vol) over(partition by symbol order by date) as cumu_usd_vol
from flow.core.ez_token_transfers join prices on token_contract = token_address and date(block_timestamp) = pdate
and tx_succeeded = 'TRUE'
group by date, symbol
Run a query to Download Data