0-MID23
Updated 2024-01-15
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
›
⌄
with tab1 as (
select date_trunc('minute',BLOCK_TIMESTAMP)as time
,AMOUNT_OUT_USD
,ORIGIN_FROM_ADDRESS
from arbitrum.defi.ez_dex_swaps
where PLATFORM='uniswap-v3'
and BLOCK_TIMESTAMP>='2023-10-01'
and AMOUNT_OUT_USD is not null
and SYMBOL_OUT='ARB'
),
tab2 as (
select date_trunc('day',time)as day
,AMOUNT_OUT_USD
,ORIGIN_FROM_ADDRESS
,row_number()over(partition by ORIGIN_FROM_ADDRESS order by day) as time_row
from tab1
)
select day
,count(ORIGIN_FROM_ADDRESS) as new_buyers
,sum(AMOUNT_OUT_USD) as buy_volume
,sum(new_buyers)over(order by day) as total_new_buyers
,sum(buy_volume)over(order by day) as total_volume
from tab2
where time_row=1
group by 1
QueryRunArchived: QueryRun has been archived