MLDZMNHIP1.1
    Updated 2022-11-29
    with price_tab as (
    select recorded_at::date as day,
    symbol as symbol11,
    avg (price) as token_price
    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 symbol11,
    avg (price) as token_price
    from ethereum.core.fact_hourly_token_prices
    group by 1,2),

    tb1 as (SELECT
    tx_id,
    count(tx_id) as no_txn
    from osmosis.core.fact_liquidity_provider_actions
    where tx_status='SUCCEEDED'
    and ACTION='pool_joined'
    group by 1 having no_txn>1
    ),

    Run a query to Download Data