Updated 2022-11-24
    with a as

    (SELECT
    avg (PRICE) as prices ,date_trunc('DAY',HOUR) as date
    FROM optimism.core.fact_hourly_token_prices
    WHERE SYMBOL = 'OP'
    group by date)

    select
    avg(prices) over(
    order by date
    rows between 199 preceding and current row ) moving_avg200,
    avg(prices) over(
    order by date
    rows between 49 preceding and current row ) moving_avg50,
    avg(prices) over(
    order by date
    rows between 19 preceding and current row ) moving_avg20,
    prices,
    date
    from a
    Run a query to Download Data