amir007-Q63RX1DEX Change - Osmosis - Swap Stats (Volume)
    Updated 2022-11-17
    with price as
    (
    select recorded_at::date as date
    , symbol
    , avg(price) as avg_price
    from osmosis.core.dim_prices
    group by 1, 2
    )
    select date_trunc('week', block_timestamp) as "Date"
    , case when "Date" = '2022-11-14' then 'Painful Week' else 'Normal Week' end as "Week Type"
    , sum ((from_amount * avg_price) / pow(10,from_decimal)) as "Sum Of Volume ($)"
    from osmosis.core.fact_swaps swp
    join osmosis.core.dim_labels lbl on swp.from_currency = lbl.address
    join price prc on lbl.project_name = prc.symbol
    and swp.block_timestamp::date = prc.date
    where tx_status = 'SUCCEEDED'
    and block_timestamp::date > current_date - interval '7 week'
    and from_currency != 'ibc/67C89B8B0A70C08F093C909A4DD996DD10E0494C87E28FD9A551697BF173D4CA'
    group by 1, 2
    order by 1

    Run a query to Download Data