linda20-4DtLkeUntitled Query
Updated 2022-11-02
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
›
⌄
with base as (select date_trunc('week', block_timestamp) as day,
'ETH' as symbol,
sum(amount_usd) as usd_volume,
sum(amount_usd) / count(distinct(tx_hash)) as avg_volume,
sum(usd_volume) over (partition by symbol order by day) as cumulative_usd_volume,
avg(usd_volume) over (order by day rows between 6 preceding and current row) as ma_usd_volume,
count(distinct(tx_hash)) as tx_count,
sum(tx_count) over (partition by symbol order by day) as cumulative_tx_count,
count(distinct(origin_from_address)) as wallet_count
from ethereum.core.ez_eth_transfers
where day >= '2022-01-01'
and eth_to_address ilike '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1'
group by 1,2
union
select date_trunc('week', block_timestamp) as day,
symbol,
sum(amount_usd) as usd_volume,
sum(amount_usd) / count(distinct(tx_hash)) as avg_volume,
sum(usd_volume) over (partition by symbol order by day) as cumulative_usd_volume,
avg(usd_volume) over (order by day rows between 6 preceding and current row) as ma_usd_volume,
count(distinct(tx_hash)) as tx_count,
sum(tx_count) over (partition by symbol order by day) as cumulative_tx_count,
count(distinct(origin_from_address)) as wallet_count
from ethereum.core.ez_token_transfers
where day >= '2022-05-02'
and to_address ilike '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1'
and symbol in ('USDC', 'USDT', 'DAI')
group by 1,2)
select * from base order by 3 desc
Run a query to Download Data