kidaUniswap VS ETH Price
    Updated 2021-08-18
    WITH avg_eth_price AS (
    SELECT
    TRUNC(hour, 'day') as date,
    AVG(price) as avg_eth_price
    FROM
    ethereum.token_prices_hourly
    WHERE
    symbol = 'ETH'
    GROUP BY 1
    ),

    total_swap_volume AS (
    SELECT
    TRUNC(block_timestamp, 'day') as date,
    SUM(amount_usd) as total_usd
    FROM
    ethereum.dex_swaps s
    WHERE
    amount_usd < POW(10,7) --remove all weird transactions
    AND platform LIKE '%uniswap%'
    GROUP BY 1
    )

    SELECT
    p.date,
    total_usd,
    avg_eth_price
    FROM
    avg_eth_price p
    JOIN
    total_swap_volume s
    ON s.date = p.date
    Run a query to Download Data