Updated 2025-03-24
    with

    pricet as (
    select
    hour::date as date,
    avg(price) as token_price_usd
    from
    avalanche.price.ez_prices_hourly
    where
    token_address = '0xb8d7710f7d8349a506b75dd184f05777c82dad0c'
    group by 1
    ),

    main as (
    select
    tx_hash,
    block_timestamp,
    iff(token_in = '0xb8d7710f7d8349a506b75dd184f05777c82dad0c', amount_in, amount_out) as amount,
    coalesce(amount_in_usd, amount_out_usd, amount * token_price_usd) as amount_usd,
    origin_from_address as trader,
    symbol_in,
    symbol_out,
    iff(token_in = '0xb8d7710f7d8349a506b75dd184f05777c82dad0c', 'Sell', 'Buy') as trade_side
    from
    avalanche.defi.ez_dex_swaps
    left join
    pricet on block_timestamp::date = date
    where
    '0xb8d7710f7d8349a506b75dd184f05777c82dad0c' in (token_in, token_out)
    )

    select
    count(distinct tx_hash) as swaps,
    count(distinct trader) as traders,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as average_amount_usd,
    Last run: 18 days ago
    SWAPS
    TRADERS
    VOLUME_USD
    AVERAGE_AMOUNT_USD
    MEDIAN_AMOUNT_USD
    VOLUME
    AVERAGE_AMOUNT
    MEDIAN_AMOUNT
    1
    1270471676339078754.5327295194.2390216811.054365244198.3212921693.0258131141276.691155725
    1
    100B
    5s