Popex404Cumulative Holders DYDX by Balance
Updated 2024-07-24
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
›
⌄
with lastdate as (select
USER_ADDRESS as address,
max(LAST_ACTIVITY_BLOCK_TIMESTAMP) as cohortDate
FROM ethereum.core.ez_current_balances
where symbol='DYDX' and token_name='dYdX'
and user_address not in (select address from ethereum.core.dim_labels where address_name is not null)
and current_bal is not null and current_bal >0
GROUP BY 1
)
select
Date_trunc('day',LAST_ACTIVITY_BLOCK_TIMESTAMP) as "Date",
count (distinct case when current_bal <= 10 then user_address else null end) as "a",
count (distinct case when current_bal > 10 and current_bal <= 100 then user_address else null end) as "b",
count (distinct case when current_bal > 100 and current_bal <= 1000 then user_address else null end) as "c",
count (distinct case when current_bal > 1000 and current_bal <= 10000 then user_address else null end) as "d",
count (distinct case when current_bal > 10000 and current_bal <= 100000 then user_address else null end) as "e",
count (distinct case when current_bal > 100000 and current_bal <= 1000000 then user_address else null end) as "f",
count (distinct case when current_bal > 1000000 and current_bal <= 10000000 then user_address else null end) as "g",
count (distinct case when current_bal > 10000000 then user_address else null end) as "h",
sum ("a") over (order by "Date") as "a 10 or Less DYDX",
sum ("b") over (order by "Date") as "b 10-100 DYDX",
sum ("c") over (order by "Date") as "c 100-1,000 DYDX",
sum ("d") over (order by "Date") as "d 1,000-10,000 DYDX",
sum ("e") over (order by "Date") as "e 10,000-100,000 DYDX",
sum ("f") over (order by "Date") as "f 100,000-1,000,000 DYDX",
sum ("g") over (order by "Date") as "g 1,000,000-10,000,000 DYDX",
sum ("h") over (order by "Date") as "h more than 10M DYDX"
FROM ethereum.core.ez_current_balances join lastdate on address = user_address and cohortDate = LAST_ACTIVITY_BLOCK_TIMESTAMP
where symbol='DYDX' and token_name='dYdX'
and current_bal is not null and current_bal >0
GROUP BY 1
QueryRunArchived: QueryRun has been archived