mlhcount of flow holders based on balance
Updated 2022-11-29
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
›
⌄
select count (distinct flowuser) as holders,
case when balance < 5 then 'Less than 5 $Flow'
when balance >= 5 and balance < 10 then 'between 5 to 10 $Flow'
when balance >= 10 and balance < 100 then 'between 10 to 100 $Flow'
when balance >= 100 and balance < 1000 then 'between 100 to 1K $Flow'
when balance >= 1000 and balance < 10000 then 'between 1K to 10K $Flow'
else 'More than 10K $Flow' end as balance
from (select a.flowuser,
sum (deposit_volume - withdraw_volume) as Balance
from (select event_data:to as flowuser,
sum (event_data:amount) as Deposit_Volume
from flow.core.fact_events
where event_contract = 'A.1654653399040a61.FlowToken'
and event_type = 'TokensDeposited'
and tx_succeeded = 'TRUE'
group by 1) a join (select event_data:from as flowuser,
sum (event_data:amount) as Withdraw_Volume
from flow.core.fact_events
where event_contract = 'A.1654653399040a61.FlowToken'
and event_type = 'TokensWithdrawn'
and tx_succeeded = 'TRUE'
group by 1) b on a.flowuser = b.flowuser
where a.flowuser != 'null'
group by 1
)
group by 2
Run a query to Download Data