Afonso_DiazUntitled Query
    Updated 2023-01-25
    select
    block_timestamp::date as day,
    iff(block_timestamp::date >= '2023-01-14', 'After Announcement', 'Before Announcement') as timespan,
    count(distinct tx_id) as txns_count,
    count(distinct iff(action = 'Delegate', tx_id, null)) as stakes_count,
    txns_count - stakes_count as unstakes_count,
    sum(case action when 'Delegate' then amount when 'Undelegate' then -1 * amount else null end) as net_volume,
    avg(case action when 'Delegate' then amount when 'Undelegate' then -1 * amount else null end) as average_volume,
    sum(stakes_count) over (order by day) as cumulative_stakes_count,
    sum(unstakes_count) over (order by day) as cumulative_unstakes_count
    from terra.core.ez_staking
    where block_timestamp between date('2023-01-14') - interval '1 week' and date('2023-01-14') + interval '1 week'
    and tx_succeeded = 1
    group by 1, 2
    order by 1
    Run a query to Download Data