Soheil_MKUntitled Query
    Updated 2022-11-23
    with BTC_price as (
    select
    date_trunc('day', hour) as date,
    avg(price) as BTC_price,
    lag(BTC_price) ignore nulls over(order by date asc) as lag_BTC_price,
    ((BTC_price-lag_BTC_price)/ lag_BTC_price)*100 as BTC_volatility
    from ethereum.token_prices_hourly
    where symbol = 'WBTC'
    and date >='2022-11-01'
    group by date
    order by date
    ),
    eth_price as (
    select
    date_trunc('day', hour) as date,
    avg(price) as eth_price,
    lag(eth_price) ignore nulls over(order by date asc) as lag_eth_price,
    ((eth_price-lag_eth_price)/ lag_eth_price)*100 as ETH_volatility
    from ethereum.token_prices_hourly
    where symbol = 'WETH'
    and date >='2022-11-01'
    group by date
    order by date
    ),

    main1 as (
    select
    btc.date,
    btc.BTC_price,
    eth.eth_price,
    BTC_volatility,
    ETH_volatility
    from BTC_price btc
    join eth_price eth
    on btc.date=eth.date
    Run a query to Download Data