HosseinUntitled Query
    Updated 2022-12-08
    with prices as (
    select
    hour::date as day,
    avg(price) as price_usd
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    group by 1
    )

    select
    'Uniswap' "Platform",
    sum(tx_fee) "Total Fee (ETH)",
    avg(tx_fee) "Average Fee (ETH)",
    median(tx_fee) "Median Fee (ETH)",
    sum(tx_fee * price_usd) "Total Fee (USD)",
    avg(tx_fee * price_usd) "Average Fee (USD)",
    median(tx_fee * price_usd) "Median Fee (USD)"
    from ethereum.uniswapv3.ez_swaps a
    join ethereum.core.fact_transactions b
    join prices
    on b.block_timestamp::date = prices.day
    using (tx_hash)
    where 1 = 1
    and a.block_timestamp >= current_date - interval '2 weeks'
    group by 1
    Run a query to Download Data