0-MIDswapper type
Updated 2025-03-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
35
36
›
⌄
with act1 as (
select date_trunc('day',BLOCK_TIMESTAMP) as day
,count(distinct ORIGIN_FROM_ADDRESS) as total_swappers
from avalanche.defi.ez_dex_swaps
where platform in('pharaoh-v1','pharaoh-v2')
and BLOCK_TIMESTAMP::date>=current_date-30
group by 1
),
act2 as (
with tab1 as (
select ORIGIN_FROM_ADDRESS
,min(BLOCK_TIMESTAMP::date) as first_time
from avalanche.defi.ez_dex_swaps
where platform in('pharaoh-v1','pharaoh-v2')
and BLOCK_TIMESTAMP::date>=current_date-30
group by 1)
select date_trunc('day',first_time) as day
,count(distinct ORIGIN_FROM_ADDRESS) as new_swappers
from tab1
group by 1
)
select
act1.day
,new_swappers
,total_swappers-new_swappers as active_swappers
,sum(new_swappers)over(order by act1.day) as total_new_swappers
from act1
left join act2
on act1.day=act2.day
QueryRunArchived: QueryRun has been archived