0-MIDweekly volume by new stakers
    Updated 2024-12-28

    with tab1 as (
    select date_trunc('minute',BLOCK_TIMESTAMP) as time
    ,AMOUNT/1e6 as vol
    ,DELEGATOR_ADDRESS
    from axelar.gov.fact_staking
    where BLOCK_TIMESTAMP::date>='2024-01-01'and BLOCK_TIMESTAMP::date<='2024-03-31'
    and ACTION='delegate'
    and TX_SUCCEEDED='true'
    ),
    tab2 as (
    select date_trunc('week',time) as week
    ,DELEGATOR_ADDRESS
    ,vol
    ,row_number()over(partition by DELEGATOR_ADDRESS order by week) as time_row
    from tab1
    )
    select week
    ,sum(vol) as volume
    ,sum(volume)over(order by week) as total_volume
    from tab2
    where time_row=1
    group by 1






    QueryRunArchived: QueryRun has been archived