0xBlackfishZeta Traders + Stakers
    Updated 2023-10-11
    with
    liquid_stakers as (
    select distinct s.signer
    from solana.core.ez_signers s
    where
    (
    array_contains('MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD'::variant,s.programs_used) or -- marinade
    array_contains('CrX7kMhLC3cSsXJdT7JDgqrRVWGnUpX3gfEfxxU2NVLi'::variant,s.programs_used) or -- lido
    array_contains('SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy'::variant,s.programs_used) or -- jito, blaze, marginfi
    array_contains('Stake11111111111111111111111111111111111111'::variant,s.programs_used)
    )
    ),

    base as (
    select
    s.signer
    , case when s.signer in (select signer from liquid_stakers) then true else false end as has_used_staking
    from solana.core.ez_signers s
    where
    (
    --array_contains('mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68'::variant,s.programs_used) or -- mango_v3
    --array_contains('4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg'::variant,s.programs_used) or -- mango_v4
    --array_contains('dammHkt7jmytvbS3nHTxQNEcP59aE57nxwV21YdqEDN'::variant,s.programs_used) or -- drift_v1
    --array_contains('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH'::variant,s.programs_used) or -- drift_v2
    array_contains('ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD'::variant,s.programs_used) -- zeta
    )
    and s.last_tx_date >= date('2022-10-01')
    )

    select
    count(case when b.has_used_staking then b.signer end) as traders_who_stake
    , count(b.signer) as traders
    , count(case when b.has_used_staking then b.signer end) / count(b.signer)
    from base b
    Run a query to Download Data