amir007-Q63RX1Osmosis - Daily Active User - Swaps vs LPs
    Updated 2022-10-19
    with osmo_pool as
    (
    select date_trunc('day', block_timestamp::date) as date
    , sum(case when action = 'pool_joined' then amount/1e6 else 0 end) as pool_joined_Osmo
    , sum(case when action = 'pool_exited' then amount/1e6 else 0 end) as pool_exited_Osmo
    , sum(case when action = 'pool_joined' then amount/1e6 else 0 end)
    - sum(case when action = 'pool_exited' then amount/1e6 else 0 end) as pool_Osmo
    from osmosis.core.fact_liquidity_provider_actions
    where block_timestamp::date > current_date - {{PastDays}}
    and currency = 'uosmo'
    group by 1
    ), osmo_swap as
    (
    select date_trunc('day', block_timestamp::date) as date
    , sum((case when from_currency = 'uosmo' then from_amount else to_amount end) / 1e6) as sum_osmo_amount
    from osmosis.core.fact_swaps
    where block_timestamp::date > current_date - {{PastDays}}
    and (from_currency = 'uosmo' or to_currency = 'uosmo')
    group by 1
    )
    select osmo_pool.date as "Date"
    , pool_Osmo as "Pool Omso"
    , sum_osmo_amount as "Swap Osmo"
    from osmo_pool
    left join osmo_swap on osmo_pool.date = osmo_swap.date
    order by 1

    Run a query to Download Data