h4wkdays held
    Updated 2023-03-29
    -- forked from 0fd27af6-f090-4dd1-a34d-2c3a80d9f973

    with buy as (
    select min(block_timestamp::date) as date, buyer, nft_id
    from flow.core.ez_nft_sales
    where nft_collection ilike '%dimension%' and tx_succeeded = TRUE
    group by 2,3)
    , sold as (
    select min(block_timestamp::date) as sale_date, seller, nft_id
    from flow.core.ez_nft_sales
    where nft_collection ilike '%dimension%' and tx_succeeded = TRUE
    and seller in (select buyer from buy) and nft_id in (select nft_id from buy)
    group by 2,3)
    , final as (
    select datediff(day, date, sale_date) as date_diff, buyer, seller, a.nft_id
    from sold a join buy b
    on a.seller = b.buyer and a.nft_id = b.nft_id where date_diff >= 0)

    select avg(date_diff) as avg_held
    from final




    Run a query to Download Data