amelia-leevolume
Updated 2022-11-21
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
›
⌄
select
date_trunc('week', BLOCK_TIMESTAMP) as date,
SYMBOL,
avg (PRICE_USD) as Price,
count (distinct TX_ID) as TXN,
count (distinct TRADER) as Users,
sum ( DISTINCT TOKEN_IN_AMOUNT) as volume,
volume * Price as USD,
sum (TXN) over (partition by SYMBOL order by date ) as cum_TXN,
sum (Users) over (partition by SYMBOL order by date ) as cum_Users,
sum (USD) over (partition by SYMBOL order by date ) as cum_USD
FROM flow.core.ez_swaps
JOIN flow.core.fact_prices ON TOKEN_CONTRACT = TOKEN_IN_CONTRACT and TIMESTAMP::DATE = BLOCK_TIMESTAMP::DATE
WHERE TOKEN IS NOT NULL and TOKEN_IN_AMOUNT > 0 and PRICE_USD > 0
group by 1,2
Run a query to Download Data