Updated 2022-10-08
    with tb1 as (select
    PROJECT_NAME as NFTs,
    count(tx_hash) as no_sale,
    count(distinct BUYER_ADDRESS) as no_buyer,
    sum(price_usd) as volume
    from ethereum.core.ez_nft_sales
    where PLATFORM_NAME='rarible'
    and NFTs is not null
    group by 1 having volume is not null
    order by 4 desc limit 10
    )

    select
    date_trunc('week',block_timestamp)as week,
    PROJECT_NAME as NFTs,
    count(tx_hash) as no_sale,
    count(distinct BUYER_ADDRESS) as no_buyer,
    sum(price_usd) as volume,
    avg(price_usd) as average_volume,
    --avg(average_volume) OVER (ORDER BY day ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) as MA_7_Days,
    sum(volume) over (partition by NFTs order by week) as cum_volume
    from ethereum.core.ez_nft_sales
    where PLATFORM_NAME='rarible'
    and NFTs in (select NFTs from tb1)
    group by 1,2 having NFTs is not null


    Run a query to Download Data