select
date_trunc('day', hour)::date as day,
avg(price) as average_op_price,
avg (average_op_price) over (order by day rows between 6 preceding and current row) as moving_average_1_week
from optimism.core.fact_hourly_token_prices
where 1 = 1
and hour >= '2022-10-01'
and token_address = '0x4200000000000000000000000000000000000042'
group by day
order by day asc