adriaparcerisasPolygon fees comparison
    Updated 2022-07-08
    WITH
    poly_price as (
    SELECT
    trunc(hour,'day') as dates,
    avg(price) as poly_price
    from ethereum.core.fact_hourly_token_prices
    where symbol='MATIC' and hour> CURRENT_DATE-INTERVAL '1 MONTH'
    group by 1
    ),
    poly as (
    SELECT
    trunc(block_timestamp,'day') as date,
    avg(tx_fee*poly_price) as avg_fee_per_tx_usd
    from polygon.core.fact_transactions x
    join poly_price y on trunc(x.block_timestamp,'day')=y.dates
    where block_timestamp> CURRENT_DATE-INTERVAL '1 MONTH' and tx_fee is not null
    group by 1
    ),
    avax_price as (
    SELECT
    trunc(hour,'day') as dates,
    avg(price) as avax_price
    from ethereum.core.fact_hourly_token_prices
    where symbol='WAVAX' and hour> CURRENT_DATE-INTERVAL '1 MONTH'
    group by 1
    ),
    avx as (
    SELECT
    trunc(block_timestamp,'day') as date,
    case when avg(tx_fee*avax_price) is null then avg(tx_fee*20) else
    avg(tx_fee*avax_price) end as avg_fee_per_tx_usd
    from avalanche.core.fact_transactions x
    join avax_price y on trunc(x.block_timestamp,'day')=y.dates
    where block_timestamp> CURRENT_DATE-INTERVAL '1 MONTH' and tx_fee is not null
    group by 1
    ),
    Run a query to Download Data