hessTotal and Average New Buyers
    Updated 2024-09-15
    with price as ( select hour::date as day,
    avg(price) as avg_price
    from aptos.price.ez_prices_hourly
    where symbol = 'APT'
    and day >= '2024-01-01'
    group by 1)
    ,
    nfts as ( select trunc(block_timestamp,'day') as date,
    count(DISTINCT tx_hash) as "Transactions",
    count(*) as "Sales",
    sum("Sales") over (order by date asc) as "Cumulative Sales",
    sum("Transactions") over (order by date asc) as "Cumulative Transactions",
    count(DISTINCT buyer_address) as "Buyers",
    count(DISTINCT seller_address) as "Sellers",
    count(DISTINCT nft_address) as "Collections",
    count(DISTINCT platform_address) as "Platforms",
    sum(total_price) as "Volume (APT)",
    avg(total_price) as "Avg Price (APT)",
    median(total_price) as "Median Price (APT)",
    max(total_price) as "Max Price (APT)",
    min(total_price) as "Min Price (APT)",
    sum(platform_fee) as "Platform Fees (APT)",
    avg("Volume (APT)") over (order by date rows between 7 preceding and current row) as avg_7_day_moving,
    avg("Volume (APT)") over (order by date rows between 14 preceding and current row) as avg_14_day_moving,
    avg("Volume (APT)") over (order by date rows between 30 preceding and current row) as avg_30_day_moving
    from aptos.nft.ez_nft_sales
    where project_name not in ('Cellana Voting Tokens')
    and date >= '2024-01-01'
    group by 1
    )
    ,
    min as ( select min(block_timestamp::date) as date,
    buyer_address
    from aptos.nft.ez_nft_sales
    group by 2)
    ,
    QueryRunArchived: QueryRun has been archived