Updated 2023-01-06
    --credit alik110
    with holding as (
    select block_timestamp::Date as date,
    tx_to as users, sum (amount) as volume
    from solana.core.fact_transfers
    where mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    group by 1,2
    union ALL
    select block_timestamp::date as date,tx_from as users,sum(amount)*-1 as volume
    from solana.core.fact_transfers
    where mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    group by 1,2
    ),
    rendered as (
    select date,
    users,
    sum (volume) as net_volume,
    sum (net_volume) over (partition by users order by date rows between unbounded preceding and current row) as user_net
    from holding
    group by 1,2)
    select count (distinct users) as holders, avg (user_net) as avg_daily_held
    from rendered
    where user_net > 0 and date >= '2022-12-24'
    Run a query to Download Data