Updated 2025-03-29
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as user,
    nvl(amount_in_usd, amount_out_usd) as amount_usd,
    iff(token_in = lower('0x9a26f5433671751c3276a065f57e5a02d2817973'), 'Sell', 'Buy') as type,
    iff(token_in = lower('0x9a26f5433671751c3276a065f57e5a02d2817973'), amount_in, amount_out) as amount,
    symbol_in,
    symbol_out
    from
    base.defi.ez_dex_swaps
    where
    lower('0x9a26f5433671751c3276a065f57e5a02d2817973') in (token_in, token_out)
    )

    select
    type,
    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(amount) as volume,
    avg(amount) as average_amount
    from
    main
    group by 1


    Last run: 19 days ago
    TYPE
    SWAPS
    SWAPPERS
    VOLUME_USD
    AVERAGE_AMOUNT_USD
    VOLUME
    AVERAGE_AMOUNT
    1
    Sell68161873376346333770.12453.551539961125290932439.483158308.956588218
    2
    Buy882448210694346807554.78354.97772203135288511616.631134531.235293165
    2
    166B
    9s