adriaparcerisasFlow NFT wallet behavior nft day 3: poly
    Updated 2023-11-13
    with
    poly_buys as (
    SELECT
    buyer_address,
    tokenid,
    block_timestamp
    from polygon.nft.ez_nft_sales
    where block_timestamp>=current_date-INTERVAL '{{period}}'

    ),
    poly_sells as (
    SELECT
    seller_address,
    tokenid,
    block_timestamp
    from polygon.nft.ez_nft_sales
    where block_timestamp>=current_date-INTERVAL '{{period}}'

    ),
    poly_final as (
    SELECT
    x.seller_address,
    datediff('day',x.block_timestamp,y.block_timestamp) as duration
    from poly_sells x, poly_buys y where x.seller_address=y.buyer_address and x.tokenid=y.tokenid
    )
    SELECT
    case when duration <1 then 'a. Less than 24 h'
    when duration between 1 and 7 then 'b. Within a week'
    when duration between 7 and 30 then 'c. Within a month'
    else 'd. More than a month' end as duration,
    count(distinct seller_address) as counts
    from poly_final
    group by 1 order by 1 asc
    Run a query to Download Data