carlesmontalaGroundhog Day
    Updated 2023-01-18
    with luna as (
    select
    date_trunc('day',recorded_hour) as date,
    avg(close) as price_usd,
    avg (price_usd) over (order by date rows between 6 preceding and current row) as price_ma_7,
    avg (price_usd) over (order by date rows between 29 preceding and current row) as price_ma_30
    from crosschain.core.fact_hourly_prices
    where id = 'terra-luna-2'
    and date >= CURRENT_DATE-60
    group by date
    order by date desc
    ),
    solana as (
    select
    date_trunc('day',recorded_hour) as date,
    avg(close) as price_usd,
    avg (price_usd) over (order by date rows between 6 preceding and current row) as price_ma_7,
    avg (price_usd) over (order by date rows between 29 preceding and current row) as price_ma_30
    from crosschain.core.fact_hourly_prices
    where id = 'solana'
    and date >= CURRENT_DATE-60
    group by date
    order by date desc
    ),
    flow as (
    select
    date_trunc('day',recorded_hour) as date,
    avg(close) as price_usd,
    avg (price_usd) over (order by date rows between 6 preceding and current row) as price_ma_7,
    avg (price_usd) over (order by date rows between 29 preceding and current row) as price_ma_30
    from crosschain.core.fact_hourly_prices
    where id = 'flow'
    and date >= CURRENT_DATE-60
    group by date
    order by date desc
    ),
    Run a query to Download Data