select
recorded_hour::date as day,
avg(close) as price_usd,
avg (price_usd) over (order by day rows between 6 preceding and current row) as price_ma_7
from crosschain.core.fact_hourly_prices
where id = 'ethereum'
and day >= '2022-06-01'
group by day
order by day