Ali3NAverage Holding Time of $BONK Token
    Updated 2023-01-05
    with maintable as (
    select block_timestamp,
    tx_from as User1,
    sum (amount)*-1 as Volume
    from solana.core.fact_transfers
    where mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    group by 1,2

    union ALL

    select block_timestamp,
    tx_to as User1,
    sum (amount) as Volume
    from solana.core.fact_transfers
    where mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    group by 1,2),

    finaltable as (
    select block_timestamp,
    User1,
    sum (Volume) as Net_Volume,
    sum (Net_Volume) over (partition by User1 order by block_timestamp rows between unbounded preceding and current row) as User_Net_Volume
    from maintable
    group by 1,2),
    table1 as (
    select User1,
    min (block_timestamp) as Mindate
    from finaltable
    where User_Net_Volume > 0
    group by 1),

    table2 as (
    select User1,
    max (block_timestamp) as Maxdate
    from finaltable
    Run a query to Download Data