Team 62023-11-16 03:32 PM
    Updated 2023-11-16
    WITH TimeDifferences AS (
    SELECT
    BLOCK_TIMESTAMP,
    LAG(BLOCK_TIMESTAMP) OVER (ORDER BY BLOCK_TIMESTAMP) AS previous_timestamp,
    EXTRACT(EPOCH FROM BLOCK_TIMESTAMP) - EXTRACT(EPOCH FROM LAG(BLOCK_TIMESTAMP) OVER (ORDER BY BLOCK_TIMESTAMP)) AS time_difference
    FROM ETHEREUM.nft.ez_nft_sales
    WHERE nft_address = '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270'
    AND event_type = 'sale'
    )

    SELECT
    nft_address,
    event_type,
    AVG(time_difference) AS average_holding_time_seconds
    FROM TimeDifferences, ETHEREUM.nft.ez_nft_sales
    WHERE previous_timestamp IS NOT NULL
    GROUP BY nft_address, event_type;

    Run a query to Download Data