Eman-RazMedian Daily Liquidity Providers
    Updated 2023-04-13
    with tab1 as (select date_trunc('day',block_timestamp) as "Date", count(distinct LIQUIDITY_PROVIDER_ADDRESS) as "Addresses", CASE
    when action='provide_liquidity' then 'Liquidity Providers'
    else 'Liquidity Withdrawers'
    end as "User Type", case
    when "Date"<'2023-01-01' then 'Year 2022'
    else 'Year 2023'
    end as "Year"
    from terra.core.fact_lp_actions
    where block_timestamp::date>='2022-12-01' and tx_succeeded='TRUE' and (action='provide_liquidity' or action='withdraw_liquidity')
    group by 1,3
    order by 1)

    select "User Type", round(median("Addresses")) as "Median Address Count", "Year"
    from tab1
    group by 1,3
    Run a query to Download Data