MLDZMNio5
Updated 2022-11-01
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 tb2 as (select
BLOCK_TIMESTAMP,
tx_hash,
ORIGIN_FROM_ADDRESS,
amount_usd,
SYMBOL as token
from ethereum.core.ez_token_transfers
where origin_to_address = '0x25ace71c97b33cc4729cf772ae268934f7ab5fa1'
and symbol in ('USDC','USDT','DAI','LUSD')
union
select
BLOCK_TIMESTAMP,
tx_hash,
ORIGIN_FROM_ADDRESS,
amount_usd,
'ETH' as token
from ethereum.core.ez_eth_transfers
where origin_to_address = '0x25ace71c97b33cc4729cf772ae268934f7ab5fa1')
select
date_trunc('{{Time_basis}}',BLOCK_TIMESTAMP) as date,
token,
count(tx_hash) as no_sent,
sum(amount_usd) as volume,
avg(amount_usd) as avg_volume,
count(distinct ORIGIN_FROM_ADDRESS) as no_users,
no_sent/no_users as average_user,
avg(avg_volume) OVER (partition by token ORDER BY date ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) as MA_7_Days,
sum(no_sent) over (partition by token order by date rows between unbounded preceding and current row ) as cum_bridges,
sum(no_users) over (partition by token order by date rows between unbounded preceding and current row ) as cum_users,
sum(volume) over (partition by token order by date rows between unbounded preceding and current row ) as cum_volume
from tb2
where BLOCK_TIMESTAMP>=CURRENT_DATE- {{Time_period}}
group by 1,2
Run a query to Download Data