Afonso_Diazliqudiity active days copy
    Updated 2023-12-31
    with t as (
    select
    tx_hash,
    action,
    block_timestamp,
    iff(block_timestamp::date >= '2023-08-27', 'Bull Market', 'Bear Market') as timespan,
    liquidity_provider,
    amount0_usd + amount1_usd as amount_usd
    from
    ethereum.uniswapv3.ez_lp_actions
    where amount_usd < 1e7
    and block_timestamp::date >= '2023-01-01'
    ),

    t5 as (
    select
    timespan,
    liquidity_provider,
    count(distinct block_timestamp::date) as active_days
    from t
    group by 1, 2
    )

    select
    timespan,
    case
    when active_days = 1 then 'a. 1 day active'
    when active_days <= 7 then 'b. 1 - 7 day active'
    when active_days <= 14 then 'c. 7 - 14 day active'
    when active_days <= 21 then 'd. 14 - 21 day active'
    when active_days <= 28 then 'e. 21 - 28 day active'
    when active_days <= 35 then 'f. 28 - 35 day active'
    when active_days <= 42 then 'g. 35 - 42 day active'
    else 'h. More than 42 day active'
    end as type,
    count(distinct liquidity_provider) as liquidity_providers
    QueryRunArchived: QueryRun has been archived