0-MIDCorrelation
    Updated 2023-05-09
    with tab1 as (
    select date_trunc('month',DATE)as month,avg(BALANCE)/1e6 as avg_osmo_balance
    from osmosis.core.fact_daily_balances
    where currency = 'uosmo'
    group by 1),
    tab2 as (
    select date_trunc('month',recorded_at)as month,avg(PRICE)as osmo_price
    from osmosis.core.dim_prices
    where SYMBOL='OSMO'
    group by 1)
    select tab1.month,avg_osmo_balance,osmo_price
    from tab1
    left join tab2
    on tab1.month=tab2.month
    --where osmo_price is not null
    group by 1,2,3
    Run a query to Download Data