abbassohrabiFlow Price copy
    Updated 2023-05-14
    -- forked from 0xHaM-d / Flow Price @ https://flipsidecrypto.xyz/0xHaM-d/q/2023-04-09-10-22-am-UohUsj

    with eth_priceTb as (
    SELECT
    HOUR::date as p_date,
    avg(price) as eth_price
    FROM ethereum.core.fact_hourly_token_prices
    WHERE symbol = 'WETH'
    GROUP by 1
    )
    , btc_priceTb as (
    SELECT
    HOUR::date as p_date,
    avg(price) as btc_price
    FROM ethereum.core.fact_hourly_token_prices
    WHERE symbol = 'WBTC'
    GROUP by 1
    )
    , flow_priceTb as (
    SELECT
    RECORDED_HOUR::date as p_date,
    avg(CLOSE) as flow_price
    FROM flow.core.fact_hourly_prices
    WHERE token = 'Flow'
    GROUP by 1
    )
    SELECT
    e.p_date,
    eth_price,
    btc_price,
    flow_price
    FROM eth_priceTb e join btc_priceTb b on e.p_date = b.p_date
    join flow_priceTb a on e.p_date = a.p_date
    WHERE e.p_date BETWEEN '2022-01-01' AND current_date()


    Run a query to Download Data