Eman-RazStaked Volume in Top Pools Over Time
    Updated 2023-04-13
    with tab1 as (select pool_address, sum(stake_amount)/pow(10,24) as staked_volume
    from near.core.dim_staking_actions
    where action='Stake'
    group by 1
    order by 2 DESC
    limit 20),
    tab2 as (select date_trunc('month',block_timestamp) as date, pool_address, sum(stake_amount)/pow(10,24) as volume, action
    from near.core.dim_staking_actions
    group by 1,2,4
    order by 2 DESC)
    select date as "Date", tab1.pool_address as "Pool", volume as "Volume"
    from tab1 left join tab2 on tab1.pool_address=tab2.pool_address
    where action='Stake'
    order by 1

    Run a query to Download Data