superflyUntitled Query
    Updated 2022-11-15
    with stake as (select date_trunc('day', block_timestamp) as day,
    sum(amount) as staked_flow,
    avg(amount) as avg_stake_volume,
    sum(staked_flow) over (order by day) as cumu_staked_flow,
    count(distinct(tx_id)) as stake_tx,
    sum(stake_tx) over (order by day) as cumu_stake_tx,
    count(distinct(delegator)) as staker_count
    from flow.core.ez_staking_actions
    where tx_succeeded = 'TRUE'
    and action in ('DelegatorTokensCommitted','TokensCommitted')
    group by 1),

    unstake as (select date_trunc('day', block_timestamp) as day,
    sum(amount) as unstaked_flow,
    sum(unstaked_flow) over (order by day) as cumu_unstaked_flow,
    count(distinct(tx_id)) as unstake_tx,
    sum(unstake_tx) over (order by day) as cumu_unstake_tx,
    count(distinct(delegator)) as unstaker_count
    from flow.core.ez_staking_actions
    where tx_succeeded = 'TRUE'
    and action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn')
    group by 1)

    select a.day,
    staked_flow,
    unstaked_flow,
    staked_flow - unstaked_flow as net_stake_amt,
    (staked_flow/1036200000) * 100 as staked_ratio,
    cumu_staked_flow,
    cumu_unstaked_flow,
    cumu_staked_flow - cumu_unstaked_flow as net_flow_staked,
    stake_tx,
    unstake_tx,
    cumu_stake_tx,
    cumu_unstake_tx,
    staker_count,
    Run a query to Download Data