alitaslimiPrices Normalised
    Updated 2024-12-31
    with
    -------------------- Prices --------------------
    prices as (
    select
    hour::date as date,
    avg(price) as price
    from
    bitcoin.price.ez_prices_hourly
    group by
    date
    ),
    -------------------- 2012 --------------------
    halving_2012 as (
    select
    date,
    datediff('day', '2012-11-28', date) as day_diff,
    price,
    price / (select price from prices where date = '2012-11-28') as price_normalised
    from
    prices
    where
    date between (to_date('2012-11-28') - 180) and (to_date('2012-11-28') + 180)
    ),
    -------------------- 2016 --------------------
    halving_2016 as (
    select
    date,
    datediff('day', '2016-07-09', date) as day_diff,
    price,
    price / (select price from prices where date = '2016-07-09') as price_normalised
    from
    prices
    where
    date between (to_date('2016-07-09') - 180) and (to_date('2016-07-09') + 180)
    ),
    -------------------- 2020 --------------------
    QueryRunArchived: QueryRun has been archived