HosseinMoving Average ETH and SOL
    Updated 2022-11-24
    with t1 as (
    select
    avg(price) price_avg
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    and hour::date >= '2022-11-01'
    ),

    daily_price_eth as (
    select
    date_trunc('day', hour)::date as date,
    symbol,
    avg(price) price_eth,
    ((price_eth - price_avg) / price_avg) * 100 as change_percent_eth,
    avg(price_eth) over (order by date rows between 6 preceding and current row) as moving_average_recent_week_eth
    from ethereum.core.fact_hourly_token_prices
    join t1
    where symbol = 'WETH'
    and hour::date >= '2022-11-01'
    group by 1, 2, price_avg
    ),

    t2 as (
    select
    avg(close) price_avg
    from solana.core.fact_token_prices_hourly
    where symbol = 'SOL'
    and recorded_hour::date >= '2022-11-01'
    ),

    daily_price_sol as (
    select
    date_trunc('day', recorded_hour)::date as date,
    symbol,
    avg(close) as price_sol,
    ((price_sol - price_avg) / price_avg) * 100 as change_percent_sol,
    Run a query to Download Data