SpecterPrice
    Updated 2024-05-25
    with pepe_price_7days As (
    select AVG(price) as previous_week_price
    from ethereum.price.ez_hourly_token_prices
    where token_address=lower('0x6982508145454ce325ddbe47a25d4ec3d2311933')
    AND HOUR::DATE= Current_date - 7),
    pepe_price_30days AS (
    select AVG(price) as previous_month_price
    from ethereum.price.ez_hourly_token_prices
    where token_address=lower('0x6982508145454ce325ddbe47a25d4ec3d2311933')
    AND HOUR::DATE= Current_date - interval '1 month' ),
    pepe_price_hr As(
    select price as current_price
    from ethereum.price.ez_hourly_token_prices
    where token_address=lower('0x6982508145454ce325ddbe47a25d4ec3d2311933')
    order by hour DESC
    limit 1),
    pepe_price_ROI AS (
    SELECT MIN(price) AS price_rec
    FROM ethereum.price.ez_hourly_token_prices
    WHERE token_address = lower('0x6982508145454ce325ddbe47a25d4ec3d2311933')
    --AND price = (SELECT MIN(PRICE) FROM ethereum.price.ez_hourly_token_prices)
    )
    select current_price, ((current_price - previous_week_price)/previous_week_price)*100 as "%Price Change (7 Days)",
    ((current_price - previous_month_price)/ previous_month_price)*100 as "%Price Change (30days)",
    Round(((current_price - price_rec) / price_rec) * 100) AS "%ROI"
    from pepe_price_7days, pepe_price_30days,
    pepe_price_hr,pepe_price_ROI
    QueryRunArchived: QueryRun has been archived