AlexayUntitled Query
    Updated 2022-11-16
    -- https://app.flipsidecrypto.com/velocity/queries/177e0a01-c5fd-434c-bb20-a776b65fc8e9

    with pricet as ( select recorded_at::date as day, symbol as symbol1, avg(price) as USDPrice
    from osmosis.core.dim_prices
    group by 1,2

    union ALL

    select hour::date as day,
    case when symbol = 'USDC' then 'USDC.axl'
    when symbol = 'USDT' then 'USDT.axl'
    when symbol = 'aTUSD' then 'USDC.grv'
    when symbol = 'sUSD' then 'USDT.grv'
    when symbol = 'iUSD' then 'USDX'
    when symbol = 'WETH' then 'WETH.axl'
    when symbol = 'aWETH' then 'WETH.grv'
    when symbol = 'WBTC' then 'WBTC.axl'
    when symbol = 'uWBTC' then 'WBTC.grv'
    when symbol = 'DAI' then 'DAI.axl'
    when symbol = 'aDAI' then 'DAI.grv'
    when symbol = 'FRAX' then 'FRAX.axl'
    else symbol end as symbol1,
    avg (price) as USDPrice
    from ethereum.core.fact_hourly_token_prices
    group by 1,2)


    select block_timestamp::date as date,
    case when date < '2022-11-08' then 'Before FTX'
    when date >= '2022-11-08' then 'After FTX' end as type,
    sum (case when from_currency = 'ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273' then from_amount*USDPrice/pow(10,18) else from_amount*USDPrice/pow(10,from_decimal) end) as volume
    from osmosis.core.fact_swaps t1 join osmosis.core.dim_labels t2 on t1.from_currency = t2.address
    join pricet t3 on t2.project_name = t3.symbol1 and t1.block_timestamp::date = t3.day
    where tx_status = 'SUCCEEDED'
    and block_timestamp >= CURRENT_DATE - 90
    and from_currency != 'ibc/67C89B8B0A70C08F093C909A4DD996DD10E0494C87E28FD9A551697BF173D4CA'
    Run a query to Download Data