boomer772023-03-08 04:06 PM
    Updated 2023-03-08
    with raw as (select
    date_trunc('day', block_date) as dt,
    sum(fees_usd) as fees_usd,
    case when dt> current_date - 30 then '30days'
    when dt > current_date - 60 then '60days'
    else '90days' end as timeframe
    from osmosis.core.fact_pool_fee_day
    where dt>= current_date - 91 and fees_usd > 0
    group by 1
    order by dt desc),

    pools as (select dt, count(distinct pool_id) as pool_available,
    SUM(pool_available) OVER(ORDER BY dt asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_pools
    from (
    select
    pool_id,
    min(block_date) as dt
    from osmosis.core.fact_pool_fee_day
    group by 1)
    group by dt),

    select dt, fees_usd as current, LAG(fees_usd,1) OVER (ORDER BY dt asc) as prev,
    ((current/prev)-1)*100 as "Daily Growth Rate%"
    from raw

    Run a query to Download Data