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_IN_USD
,ORIGIN_FROM_ADDRESS
from arbitrum.defi.ez_dex_swaps
where PLATFORM='uniswap-v3'
and BLOCK_TIMESTAMP>='2023-10-01'
and AMOUNT_IN_USD is not null
and SYMBOL_IN='ARB'
),
tab2 as (
select date_trunc('day',time)as day
,AMOUNT_IN_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_sellers
,sum(AMOUNT_IN_USD) as sell_volume
,sum(new_sellers)over(order by day) as total_new_sellers
,sum(sell_volume)over(order by day) as total_volume
from tab2
where time_row=1
group by 1