MLDZMNt_stake2
    Updated 2023-01-11
    select
    case
    when BLOCK_TIMESTAMP>='2022-12-25' then 'Holidays and new year'
    else 'Before holidays' end as days,
    CASE
    when ACTION in ('TokensCommitted','DelegatorTokensCommitted') then 'Stake'
    when action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn') then 'Unstake'
    when action in ('DelegatorRewardTokensWithdrawn','RewardTokensWithdrawn') then 'Claim rewards'
    end as action_type,
    count(distinct tx_id) as no_txn,
    count(distinct DELEGATOR) as no_users,
    sum(AMOUNT) as total_flow,
    avg(amount) as avg_flow,
    median(amount)as median_flow,
    no_users/count(distinct date_trunc(day, block_timestamp)) as average_sender_day,
    total_flow/count(distinct date_trunc(day, block_timestamp)) as average_volume_day

    from flow.core.ez_staking_actions
    where TX_SUCCEEDED='TRUE'
    and BLOCK_TIMESTAMP>='2022-12-01'
    group by 1,2

    Run a query to Download Data