select
block_timestamp :: date as "Date Of Transactions",
count(tx_hash) as "Transactions",
avg(
count(tx_hash)
) over (
order by
block_timestamp :: date rows between 30 preceding
and current row
) as "30-Day MA"
from
optimism.core.fact_transactions
where
block_timestamp >= CURRENT_DATE - 90
and status = 'SUCCESS'
group by
1