adriaparcerisasDaily fees on Sushiswap 2
    Updated 2022-06-08
    WITH
    price as (
    select
    trunc(hour,'day') as date,
    avg(price) as eth_price
    from ethereum.core.fact_hourly_token_prices
    where symbol='WETH' and hour>='2022-01-01'
    group by 1
    order by 1 asc
    ),
    fees as (
    SELECT
    trunc(block_timestamp,'day') as date,
    sum(tx_fee) as daily_fees,
    sum(daily_fees) over (order by date) as cum_daily_fees
    from ethereum.core.fact_transactions
    where block_timestamp>='2022-01-01'
    and tx_hash in (select tx_hash from ethereum.core.ez_dex_swaps where block_timestamp>='2022-01-01' and platform='sushiswap')
    group by 1
    order by 1 asc
    )
    SELECT
    x.date,
    daily_fees,
    eth_price
    from fees x, price y where x.date=y.date
    order by 1 asc
    Run a query to Download Data