adriaparcerisasFlow NFT wallet behavior nft day 3: base
    Updated 2023-11-13
    with

    base_buys as (
    SELECT
    buyer_address,
    tokenid,
    block_timestamp
    from base.nft.ez_nft_sales
    where block_timestamp>=current_date-INTERVAL '{{period}}'

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

    ),
    base_final as (
    SELECT
    x.seller_address,
    datediff('day',x.block_timestamp,y.block_timestamp) as duration
    from base_sells x, base_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 base_final
    group by 1
    order by 1 asc

    Run a query to Download Data