alirsAlgo Price
    Updated 2022-06-29
    with daily_price as (
    select
    distinct block_hour::date as day
    ,avg(price_usd) over(partition by day) as avg_price_daily
    from flipside_prod_db.algorand.prices_swap
    where asset_id = 0
    and block_hour>= '2021-01-01'
    and block_hour < CURRENT_DATE
    -- order by day
    )

    select
    *
    ,lead(avg_price_daily) over(order by day) as next_day_price_usd
    , 100 * ((next_day_price_usd-avg_price_daily)/avg_price_daily) as change_percentage
    from daily_price
    order by day
    Run a query to Download Data