LittlerDataUntitled Query
    Updated 2022-10-20
    --table stole from misaghlb and refurbished by me

    with eth_price_tbl as (
    select
    date(hour) as pdate
    ,avg(price) as eth_price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    group by pdate
    ),
    matic_price_tbl as (
    select
    date(hour) as pdate
    ,avg(price) as matic_price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'MATIC'
    group by pdate
    ),
    dai_price_tbl as (
    select
    date(hour) as pdate
    ,avg(price) as dai_price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'DAI'
    group by pdate
    )

    select
    date_trunc('day', block_timestamp) as mdate
    ,sum(tx_fee*matic_price) as usd_fee
    ,avg(tx_fee*matic_price) as usd_avg_fee
    ,'Polygon' as type
    from polygon.core.fact_transactions join matic_price_tbl on date(block_timestamp) = pdate
    where date(block_timestamp) >= '2022-07-01'
    group by mdate

    Run a query to Download Data