ArashhNear mega 7
    Updated 2022-12-31
    select
    date_trunc('day',BLOCK_TIMESTAMP ) as date,
    sum(case when ACTION='Stake' then STAKE_AMOUNT/1e24 else null end) as staking_volume,
    sum(case when ACTION='Unstake' then STAKE_AMOUNT/1e24 else null end) as unstaking_volume,
    count(case when ACTION='Stake' then 1 else null end) as staking_number,
    count(case when ACTION='Unstake' then 1 else null end) as unstaking_number,
    sum(staking_volume) over (order by date) as c_staking_volume,
    sum(unstaking_volume) over (order by date) as c_unstaking_volume,
    c_staking_volume-c_unstaking_volume as net_flow
    from
    near.core.dim_staking_actions

    group by date

    Run a query to Download Data