kiacryptoETH stakers on Lido hodl or sold when price is lower than now
    Updated 2022-04-11
    with stakes as (
    select origin_address, min(block_timestamp::date) as date, sum(amount) as amount_staked
    from ethereum.udm_events
    where block_timestamp::date >= '2022-01-01' and contract_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' AND from_address = '0x0000000000000000000000000000000000000000'
    group by 1),

    balance as (
    select date, iff(balance is null, 0, balance)-amount_staked as hold_or_sold
    from ethereum.erc20_balances b join stakes s on b.user_address = s.origin_address
    where balance_date >= '2022-01-01' and contract_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' and price < 3260
    )
    select date,
    case
    when hold_or_sold>0 then 'ADDED'
    when hold_or_sold=0 then 'HOLD'
    when hold_or_sold<0 then 'SOLD'
    end as tiers, count (*)
    from balance
    group by 1, 2
    Run a query to Download Data