nsa2000Distribution of Flow delegators according to the transactions volume for different actions
    Updated 2022-11-14
    with maintable as (
    select delegator,
    case when action in ('DelegatorTokensCommitted','TokensCommitted') then 'Stake'
    when action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn') then 'Unstake'
    when action in ('DelegatorRewardTokensWithdrawn','RewardTokensWithdrawn') then 'Claim Reward' end as action_type,
    count (distinct tx_id) as TX_Count,
    count (distinct delegator) as Users_Count,
    sum (amount) as Total_Volume,
    avg (amount) as Average_Volume,
    median (amount) as Median_Volume,
    min (amount) as Min_Volume,
    max (amount) as Max_Volume
    from flow.core.ez_staking_actions
    where tx_succeeded = 'TRUE'
    group by 1,2)

    select action_type,
    case when Total_Volume < 5 then 'Less Than 5 FLOW'
    when Total_Volume >= 5 and Total_Volume < 10 then '5 - 10 FLOW'
    when Total_Volume >= 10 and Total_Volume < 100 then '10 - 100 FLOW'
    when Total_Volume >= 100 and Total_Volume < 1000 then '100 - 1000 FLOW'
    else 'More Than 1000 FLOW' end as volume_type,
    count (distinct delegator) as Users_Count
    from maintable
    group by 1,2
    Run a query to Download Data