jfoion-WETH-aero-weekly-fees
    Updated 2025-02-03
    with weekly_swaps as (
    select
    date_trunc('week', block_timestamp) as week,
    count(*) as num_swaps,
    sum(amount_in_usd) as volume_in_usd,
    sum(amount_out_usd) as volume_out_usd,
    -- Taking average of in/out USD for more accurate volume
    sum(amount_in_usd + amount_out_usd)/2 as avg_volume_usd,
    -- Aerodrome has 0.25% fee
    (sum(amount_in_usd + amount_out_usd)/2) * 0.0025 as fee_usd
    from base.defi.ez_dex_swaps
    where contract_address = lower('0x0FAc819628a7F612AbAc1CaD939768058cc0170c')
    and block_timestamp >= current_date - 90 -- Last 90 days of data
    group by 1
    )
    select
    week,
    num_swaps,
    round(avg_volume_usd, 2) as volume_usd,
    round(fee_usd, 2) as estimated_fees_usd,
    round(fee_usd/7, 2) as avg_daily_fees_usd
    from weekly_swaps
    order by week desc;
    Last run: about 1 month ago
    WEEK
    NUM_SWAPS
    VOLUME_USD
    ESTIMATED_FEES_USD
    AVG_DAILY_FEES_USD
    1
    2025-02-03 00:00:00.000392322.95.810.83
    2
    2025-01-27 00:00:00.000550152193.85380.4854.35
    3
    2025-01-20 00:00:00.00034397896.56244.7434.96
    4
    2025-01-13 00:00:00.000559189680.51474.267.74
    5
    2025-01-06 00:00:00.000536222580.51556.4579.49
    6
    2024-12-30 00:00:00.000830529876.671324.69189.24
    7
    2024-12-23 00:00:00.000773531016.121327.54189.65
    8
    2024-12-16 00:00:00.00010551168067.342920.17417.17
    9
    2024-12-09 00:00:00.00012331058147.052645.37377.91
    10
    2024-12-02 00:00:00.00014421517137.433792.84541.83
    11
    2024-11-25 00:00:00.00014101734062.044335.16619.31
    12
    2024-11-18 00:00:00.00020983062760.267656.91093.84
    13
    2024-11-11 00:00:00.00019141990805.054977.01711
    14
    2024-11-04 00:00:00.00018721175760.912939.4419.91
    14
    790B
    4s