thechriscenUniswap Fee x Swaps
    Updated 2024-07-31
    with transaction_swaps as (
    select
    block_timestamp
    , tx_hash
    , origin_from_address as user
    , coalesce(amount_in_usd, amount_out_usd) as amount_usd
    , tx_fee
    , case
    when block_timestamp::date < '2024-03-14' then 'Before fee changes'
    else 'After fee changes'
    end as timespan
    from arbitrum.defi.ez_dex_swaps
    join arbitrum.core.fact_transactions
    using (tx_hash, block_timestamp)
    where amount_usd <= 1e6
    and block_timestamp::date >= '2023-11-29'
    and platform like 'uniswap%'
    )

    select
    timespan
    , count(distinct tx_hash) as swaps
    , count(distinct user) as swappers
    , sum(amount_usd) as volume_usd
    , avg(amount_usd) as average_amount_usd
    , sum(tx_fee) as fee_volume_eth
    , avg(tx_fee) as average_fee_amount_eth
    from transaction_swaps
    where block_timestamp::date >= '2023-11-29'
    group by 1

    QueryRunArchived: QueryRun has been archived