Updated 2022-10-19
    with tab1 as
    (
    SELECT BLOCK_TIMESTAMP::date as daily ,count(DISTINCT TX_SIGNER) as stakers , SUM(STAKE_AMOUNT)*power(10,-24) as staked
    from near.core.dim_staking_actions
    where ACTION = 'Stake'
    GROUP by 1
    )
    ,
    tab2 as (
    SELECT BLOCK_TIMESTAMP::date as daily ,count(DISTINCT TX_SIGNER) as unstakers , SUM(STAKE_AMOUNT)*power(10,-24) as unstaked
    from near.core.dim_staking_actions
    where ACTION = 'Unstake'
    GROUP by 1
    )
    SELECT A.daily , unstakers , stakers , staked , -unstaked , staked-unstaked as net_staked ,
    sum(net_staked) over(order by A.daily) as cumulative_net_staked ,
    sum(staked) over(order by A.daily) as cumulative_staked ,
    -sum(unstaked) over(order by A.daily) as cumulative_unstaked
    from tab1 A , tab2 B
    where A.daily = B.daily
    Run a query to Download Data