sarathpoolofthe_week1
    Updated 2022-12-04
    with prices as (select
    recorded_at::date as price_date,
    avg(price) as usd_price
    from osmosis.core.dim_prices
    where symbol = 'OSMO'
    group by 1),

    lps as (select
    block_timestamp::date as date,
    action,
    count(distinct tx_id) as txs,
    count(distinct liquidity_provider_address) as users,
    sum(amount / power(10, decimal)) as volume,
    sum((amount / power(10, decimal)) * usd_price) as usd_volume
    from osmosis.core.fact_liquidity_provider_actions
    join prices on block_timestamp::date = price_date
    where pool_id = '833'
    and tx_status = 'SUCCEEDED'
    and action in ('pool_joined', 'pool_exited')
    group by 1,2)

    select
    case when date >= '2022-11-11' then 'after choosing'
    else 'before choosing'
    end as timeframe,
    action,
    avg(txs) as avg_txs,
    avg(users) as avg_users,
    avg(volume) as avg_vol,
    avg(usd_volume) as avg_usd
    from lps
    group by 1,2
    -- credits to pauya
    Run a query to Download Data