Updated 2022-10-27
    select--flow nft
    BLOCK_TIMESTAMP::date as day,
    CONTRACT_NAME as NFTs,
    avg(price) as avg_sale,
    avg(avg_sale) OVER (partition by NFTs ORDER BY day ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) as MA_7_Days,
    median(price) as med_price,
    min(price) as min_price,
    max(price) as max_price,
    max_price-min_price as bond_price
    from flow.core.fact_nft_sales s left join flow.core.dim_contract_labels b on s.NFT_COLLECTION=b.EVENT_CONTRACT
    where TX_SUCCEEDED='TRUE' and CURRENCY='A.ead892083b3e2c6c.DapperUtilityCoin'
    and NFTs = ('{{NFT_collection}}')
    and BLOCK_TIMESTAMP>=CURRENT_DATE- {{Time_period}}
    group by 1,2


    Run a query to Download Data