select
date_trunc('day', block_timestamp) as day,
avg(price) as "Daily Average Sales Price",
avg("Daily Average Sales Price") over (order by day asc rows between 7 preceding and current row) as "7-Day Moving Average"
from
flow.core.ez_nft_sales
where
NFT_COLLECTION like '%RaceDay%'
group by
day
order by
day asc