shengyi-chiuUntitled Query
    Updated 2022-07-16
    with ud as (with raw as (select block_timestamp as t, VALIDATOR_ADDRESS as va,DELEGATOR_ADDRESS as da, tx_id,AMOUNT/10e5 as amt
    from osmosis.core.fact_staking
    where
    currency='uosmo' and action='undelegate')

    select date_trunc('year',t) as date,sum(amt) as vol_undel
    from raw group by 1),

    d as (
    with raw as (select block_timestamp as t, VALIDATOR_ADDRESS as va,DELEGATOR_ADDRESS as da, tx_id,AMOUNT/10e5 as amt
    from osmosis.core.fact_staking
    where
    currency='uosmo' and action='delegate')

    select date_trunc('year',t) as date,sum(amt) as vol_del
    from raw group by 1 order by 1 desc


    )

    select d.date as year , vol_del as staked_vol,vol_undel as unstaked_vol
    from d inner join ud on ud.date=d.date
    --where d.date>='2022-01-01'
    order by 1
    Run a query to Download Data