amir007-Q63RX1Hot Contracts on Osmosis - Terra Crash (11-12 May)
    Updated 2022-07-10
    with cte_token_price as
    (
    select recorded_at::date as price_date
    , symbol as token_name
    , dim_labels.address as token_address
    , avg(price) as token_price
    from osmosis.core.dim_prices
    join osmosis.core.dim_labels on dim_prices.symbol = dim_labels.project_name
    where recorded_at::date >= '2022-05-01'
    group by 1, 2, 3
    )
    select block_timestamp::date as "Date (Day)"
    , sum((fact_swaps.from_amount * from_token.token_price) + (fact_swaps.from_amount * to_token.token_price)) / 1e18 as "Sum Value of Contract (usd)"
    from osmosis.core.fact_swaps
    left join cte_token_price from_token on fact_swaps.from_currency = from_token.token_address
    and fact_swaps.block_timestamp::date = from_token.price_date
    left join cte_token_price to_token on fact_swaps.to_currency = to_token.token_address
    and fact_swaps.block_timestamp::date = to_token.price_date
    where block_timestamp::date between '2022-05-10' and '2022-05-15'
    and (from_token.token_name is not null and to_token.token_name is not null)
    group by 1
    order by 1

    Run a query to Download Data