ArioWhat makes a Top Shots - average holding of every type
    Updated 2022-07-25
    with
    sales_data as (
    select
    BLOCK_TIMESTAMP,
    NFT_ID,
    BUYER,
    SELLER,
    TX_SUCCEEDED
    from flow.core.fact_nft_sales
    where
    NFT_COLLECTION = 'A.0b2a3299cc857e29.TopShot'
    and TX_SUCCEEDED = TRUE
    ),
    TopShot_Metadata as (
    select
    NFT_ID,
    PLAY_TYPE
    from flow.core.dim_topshot_metadata
    ),
    general_table as (
    select
    BLOCK_TIMESTAMP,
    m.NFT_ID as id,
    BUYER,
    SELLER,
    TX_SUCCEEDED,
    PLAY_TYPE
    --date_trunc('day', BLOCK_TIMESTAMP) as date,
    from sales_data s
    inner join TopShot_Metadata m on m.NFT_ID = s.NFT_ID
    ),
    final_table as (
    select
    t1.BLOCK_TIMESTAMP::date as buying_time,
    t2.BLOCK_TIMESTAMP::date as selling_time,
    t1.id as NFT,
    Run a query to Download Data