MLDZMNfeeusd30-2
    Updated 2023-03-10
    with tb8 as (select
    RECORDED_AT::date as day,
    SYMBOL,
    avg(PRICE) as price_token
    from osmosis.core.dim_prices
    where symbol not in ('IOV','JUNO')
    group by 1,2),

    t2 as (select
    BLOCK_DATE as day,
    sum(FEES_USD) as total_paid_fee
    from osmosis.core.fact_pool_fee_day
    where FEE_TYPE='swap'
    and day>= CURRENT_DATE - {{Time_period_days}}
    group by 1)


    SELECT
    date_trunc('day',BLOCK_TIMESTAMP) as date,
    case
    when date between '2023-02-07' and '2023-02-22' then 'OSMO/BUSD proposal'
    when date between '2023-02-15' and '2023-02-21' then 'OSMO/FTM proposal'
    when date between '2022-11-29' and '2023-01-22' then 'stOSMO/OSMO proposal'
    when date between '2022-11-09' and '2022-11-21' then 'OSMO/WMATIC proposal'
    when date between '2023-01-25' and '2023-02-02' then 'OSMO/AVAX proposal'
    when date between '2022-11-08' and '2022-11-23' then 'OSMO/WBNB proposal'
    when date between '2022-09-20' and '2022-10-19' then 'OSMO/AXL proposal'
    when date between '2022-10-11' and '2022-10-23' then 'STRD/OSMO proposal'
    else 'Other date'
    end as Time_gp,
    count(distinct TX_ID) as no_swaps,
    count(distinct TRADER) as no_trader,
    sum((TO_AMOUNT/pow(10,TO_DECIMAL))*price_token) as volume_usd,
    avg((TO_AMOUNT/pow(10,TO_DECIMAL))*price_token) as average_volume,
    median((TO_AMOUNT/pow(10,TO_DECIMAL))*price_token) as median_volume,
    avg(average_volume) OVER (ORDER BY date ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) as MA_7_Days,
    Run a query to Download Data