mattkstewPolygon Fees 4
    Updated 2022-07-07
    with tab1 as (
    select
    date_trunc('day', block_timestamp) as date1,
    avg(tx_fee) as poly_fee
    from polygon.core.fact_transactions
    where block_timestamp > '2022-07-01'
    group by 1 )

    , tab_MATIC_PRICE as (
    select
    date_trunc('day', hour) as date2,
    avg(price) as MATIC_Price
    from ethereum.core.fact_hourly_token_prices
    where symbol like 'MATIC'
    and hour > '2022-07-01'
    group by 1 )

    , tab_ETH_PRICE as (
    select
    date_trunc('day', hour) as date11,
    avg(price) as ETH_Price
    from ethereum.core.fact_hourly_token_prices
    where symbol like 'WETH'
    and hour > '2022-07-01'
    group by 1 )


    , tab_Poly_Fees as (
    select
    date1,
    MATIC_Price * poly_fee as Polygon_Fees
    from tab1 left outer join tab_MATIC_PRICE on date1 = date2 )


    , tab2 as (
    select
    Run a query to Download Data