RayyykAxelar 3
    Updated 2022-10-12
    with table_1 as (select *
    from osmosis.core.fact_swaps, table(flatten(input => pool_ids))
    where tx_status = 'SUCCEEDED'
    and block_timestamp >= current_date - 60),

    table_2 as (select date_trunc ('day', block_timestamp) as day,
    count(distinct(tx_id)) as swap_count,
    sum(swap_count) over (order by day) as cumu_swap_count,
    count(distinct(trader)) as swapper_count,
    swap_count/swapper_count as avg_swap
    from table_1
    group by 1)

    select *, (select avg(avg_swap) from table_2)
    from table_2
    order by 1 desc
    Run a query to Download Data