sepehrmhz8Untitled Query
    Updated 2022-11-28
    with ETH_price as (
    select hour::date as week,
    avg (price) as ETH_price_
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    group by 1),

    Matic_price as (
    select hour::date as week,
    avg (price) as Matic_price_
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'MATIC'
    group by 1),

    BNB_price as (
    select hour::date as week,
    avg (price) as BNB_price_
    from ethereum.core.fact_hourly_token_prices
    where token_address = lower ('0x418d75f65a02b3d53b2418fb8e1fe493759c7605')
    group by 1),

    AVAX_price as (
    select hour::date as week,
    avg (price) as AVAX_price_
    from ethereum.core.fact_hourly_token_prices
    where token_address = lower ('0x85f138bfEE4ef8e540890CFb48F620571d67Eda3')
    group by 1)

    select 'Ethereum' as NET,
    avg(tx_fee*ETH_price_) as Avg_fee,
    sum(tx_fee*ETH_price_) as total_fee
    from ethereum.core.fact_transactions t1 join ETH_price t2 on t1.block_timestamp::date = t2.week
    where to_address = '0xdef171fe48cf0115b1d80b88dc8eab59176fee57'
    and block_timestamp::date >= '2022-07-10'
    group by 1

    Run a query to Download Data