0-MID2023-06-13 04:09 AM
    Updated 2023-07-14
    with tab1 as (
    select date_trunc('month',BLOCK_TIMESTAMP)as month
    ,sum(case when FROM_CURRENCY='uosmo' then FROM_AMOUNT/1e6 end) as sell_volume
    ,sum(case when TO_CURRENCY='uosmo' then TO_AMOUNT/1e6 end) as buy_volume
    ,count(distinct case when FROM_CURRENCY='uosmo' then TRADER end) as sellers
    ,count(distinct case when TO_CURRENCY='uosmo' then TRADER end) as buyers
    ,count(distinct case when FROM_CURRENCY='uosmo' then TX_ID end) as sell_count
    ,count(distinct case when TO_CURRENCY='uosmo' then TX_ID end) as buy_count
    ,sell_volume+buy_volume as volume
    ,sellers+buyers as traders
    ,sell_count+buy_count as trades
    ,sum(volume)over(order by month) as "Volume Growth"
    ,sum(traders)over(order by month) as "Trader Growth"
    ,sum(trades)over(order by month) as "Trade Growth"
    from osmosis.core.fact_swaps
    where TX_SUCCEEDED='true'
    group by 1)
    select 'OSMO' as token
    ,avg(volume) as "Avg Volume"
    ,avg(traders) as "Avg Traders"
    ,avg(trades) as "Avg Trades"
    from tab1
    group by 1
    Run a query to Download Data