elsina✅ DeFi: 1. Total - single number
    Updated 2023-08-30
    with price as (
    select
    date_trunc('day', recorded_at) as day,
    symbol as currency,
    avg(price) as price
    from osmosis.core.dim_prices
    group by 1, 2

    union all

    select
    date_trunc('day', hour) 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 currency,
    avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    group by 1, 2
    )

    select
    count(distinct tx_id) as "Swap Count",
    count(distinct trader) as "Unique Swapper",
    sum (case when from_currency = 'ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273' then from_amount * (price/pow(10,18)) else from_amount * (price/pow(10,from_decimal)) end) as "Volume", --inj decimal is wrong
    Run a query to Download Data