hessUsers Breakdown
Updated 2023-05-10
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
›
⌄
with new_user as ( select min(block_timestamp) as date,
from_address
from avalanche.core.fact_transactions
group by 2)
,
new as ( select DISTINCT from_address
from new_user
where date >= current_date - {{N_Days}})
,
swaps as ( select date(block_timestamp) as date,'Swap to BFG' as type, tx_hash,concat(SYMBOL_IN,'/',SYMBOL_OUT) as pairs,origin_from_address, amount_out_usd as volume
from avalanche.core.ez_dex_swaps
where symbol_out = 'BFG'
and block_timestamp::date >= current_date - {{N_Days}}
UNION
select date(block_timestamp) as date,'Swap From BFG' as type, tx_hash,concat(SYMBOL_IN,'/',SYMBOL_OUT) as pairs,origin_from_address, amount_in_usd as volume
from avalanche.core.ez_dex_swaps
where symbol_in = 'BFG'
and block_timestamp::date >= current_date - {{N_Days}})
,
final as ( select origin_from_address, type, count(DISTINCT(tx_hash)) as total_tx,
sum(volume) as usd_volume
from swaps
group by 1,2)
select count(DISTINCT(origin_from_address)) as total_user,
type,
case when total_tx = 1 then '1 Tx'
when total_tx = 2 then '2 Tx'
when total_tx = 3 then '3 Tx'
when total_tx = 4 then '4 Tx'
when total_tx = 5 then '5 Tx'
when total_tx > 5 then '+5 Tx' end as cat
from final
group by 2,3
Run a query to Download Data