HosseinUntitled Query
    Updated 2022-10-25
    with stake as ( select date_trunc('day', date) as "Date",
    sum(balance/ pow(10, 6)) as "Staked"
    from osmosis.core.fact_daily_balances
    where currency = 'uosmo'
    and balance_type = 'staked'
    group by "Date"
    ),
    liquid as (
    select date_trunc('day', date) as "Date",
    sum(balance/ pow(10, 6)) as "Liquid"
    from osmosis.core.fact_daily_balances
    where balance_type = 'liquid'
    and currency = 'uosmo'
    group by "Date"
    ),

    osmo_price as (
    select date_trunc('day', recorded_at) as "Date",
    avg(price) as "Price"
    from osmosis.core.dim_prices
    where symbol = 'OSMO'
    group by "Date"
    )


    select t1."Date", "Liquid", "Staked", ("Liquid"/ "Staked") as "Liquid to Stake Ratio", "Price" as "OSMO Price"
    from liquid t1
    join stake t2
    join osmo_price
    on t1."Date" = osmo_price."Date"
    and t1."Date" = t2."Date"
    order by "Date"
    Run a query to Download Data