Eman-Raz% of price changes in Different Time Frame
    Updated 2024-01-16
    with daily_ as (with tab1 as (select PRICE as current_price
    from ethereum.price.ez_hourly_token_prices
    where token_address='0x25931894a86d47441213199621f1f2994e1c39aa'
    order by HOUR desc
    limit 1),

    tab2 as (select hour::date as date, avg(PRICE) as price
    from ethereum.price.ez_hourly_token_prices
    where token_address='0x25931894a86d47441213199621f1f2994e1c39aa' and hour::date=current_date-1
    group by 1
    order by 1)

    select ((current_price-Price)/Price)*100 as price_change, 'Daily' as "Time Frame"
    from tab1 , tab2),
    -----------------------------------------------------------------------------------------------------------
    weekly_ as (with tab1 as (select PRICE as current_price
    from ethereum.price.ez_hourly_token_prices
    where token_address='0x25931894a86d47441213199621f1f2994e1c39aa'
    order by HOUR desc
    limit 1),

    tab2 as (select hour::date as date, avg(PRICE) as price
    from ethereum.price.ez_hourly_token_prices
    where token_address='0x25931894a86d47441213199621f1f2994e1c39aa' and hour::date=current_date-7
    group by 1
    order by 1)

    select ((current_price-Price)/Price)*100 as price_change, 'Weekly' as "Time Frame"
    from tab1 , tab2),
    ------------------------------------------------------------------------------------------------------------
    monthly_ as (with tab1 as (select PRICE as current_price
    from ethereum.price.ez_hourly_token_prices
    where token_address='0x25931894a86d47441213199621f1f2994e1c39aa'
    order by HOUR desc
    limit 1),

    QueryRunArchived: QueryRun has been archived