KuramaEth price
    Updated 2022-11-05
    with eth_price as (select date_trunc('day', hour) as date, avg(price) as price_eth from ethereum.core.fact_hourly_token_prices
    where upper(token_address) = upper('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2')
    and hour >= (select min(date_trunc('hour', block_timestamp)) from ethereum.uniswapv3.ez_swaps where pool_address = '0x953c953755ddbb61a6c116f2219508f838b3219b' )
    group by date ),


    eth_price_offset as (select DATEADD(DAY, 1, date) as date, price_eth as price_eth_offs from eth_price)
    select a.date, price_eth, price_eth_offs, (price_eth - price_eth_offs) as price_change, (((price_eth/price_eth_offs)*100) - 100) as percent_diff, case when percent_diff > 0 then 'Gain' else 'Loss' end as gain_loss from eth_price a
    left join eth_price_offset b
    on a.date = b.date

    Run a query to Download Data