Ludwig_1989Price Hourly VS Tokens
    Updated 2023-02-19
    with Near as (
    select date_trunc('hour', TIMESTAMP) as "DATE", avg(PRICE_USD) as Near_price, LAG(Near_price,1) IGNORE NULLS OVER (order by "DATE") as Near_price_next,
    ((Near_price-Near_price_next)/Near_price)*100 as Near_change
    from near.core.fact_prices
    where TOKEN = 'Wrapped NEAR fungible token'
    and DATE > '2023-02-05' and DATE < '2023-02-20'
    group by 1),

    OP as ( select date_trunc('hour', HOUR) as "DATE", avg(price) as op_price, LAG(op_price,1) IGNORE NULLS OVER (order by "DATE") as op_price_next,
    ((op_price-op_price_next)/op_price)*100 as op_change
    from optimism.core.fact_hourly_token_prices
    where symbol = 'OP'
    and hour::date > '2023-02-05' and hour::date < '2023-02-20'
    group by 1)
    ,
    matic_price as ( select date_trunc('hour', HOUR) as "DATE", avg(price) as matic_price, LAG(matic_price,1) IGNORE NULLS OVER (order by "DATE") as matic_price_next,
    ((matic_price-matic_price_next)/matic_price)*100 as matic_change
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'MATIC'
    and hour::date > '2023-02-05' and hour::date < '2023-02-20'
    group by 1)
    ,
    eth_price as ( select date_trunc('hour', HOUR) as "DATE", avg(price) as eth_price, LAG(eth_price,1) IGNORE NULLS OVER (order by "DATE") as eth_price_next,
    ((eth_price-eth_price_next)/eth_price)*100 as eth_change
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    and hour::date > '2023-02-05' and hour::date < '2023-02-20'
    group by 1)
    ,
    btc_price as ( select date_trunc('hour', HOUR) as "DATE", avg(price) as BTC_price, LAG(BTC_price,1) IGNORE NULLS OVER (order by "DATE") as btc_price_next,
    ((BTC_price-btc_price_next)/BTC_price)*100 as btc_change
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WBTC'
    and hour::date > '2023-02-05' and hour::date < '2023-02-20'
    Run a query to Download Data