tarikflipsidelargest hourly price decrease
    Updated 2023-06-21
    -- hourly price changes
    with cte as (
    SELECT *,
    ((close/(LAG(close, 1, close) OVER(Partition by token_address ORDER BY recorded_hour))) - 1)*100 AS price_pct_change_1hr,
    -- ((price_usd/(LAG(price_usd, 24, price_usd) OVER(Partition by asset_id ORDER BY block_hour))) - 1)*100 AS price_pct_change_24h,
    DENSE_RANK() OVER (Partition by token_address ORDER BY recorded_hour Desc) AS Rnk
    FROM solana.core.ez_token_prices_hourly
    )

    -- Select the second row b/c the first is usually 0
    SELECT *
    from cte
    WHERE Rnk = 2
    AND price_pct_change_1hr <> 0
    order by price_pct_change_1hr asc
    LIMIT 10
    Run a query to Download Data