Updated 2 days ago
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    swapper,
    platform,
    case
    when amount_in_usd > 0 and amount_out_usd > 0 then least(amount_in_usd, amount_out_usd)
    when amount_in_usd > 0 then amount_in_usd
    when amount_out_usd > 0 then amount_out_usd
    end as amount_usd,
    symbol_in,
    symbol_out,
    token_in,
    token_out
    from
    aptos.defi.ez_dex_swaps
    where
    amount_usd < 1e7
    and amount_usd > 0
    )

    select
    count(distinct tx_hash) as swaps,
    count(distinct swapper) as swappers,
    count(distinct platform) as platforms,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as average_amount_usd,
    swaps / count(distinct block_timestamp::date) as daily_average_swaps,
    swappers / count(distinct block_timestamp::date) as daily_average_swappers
    from main
    Last run: 1 day ago
    SWAPS
    SWAPPERS
    PLATFORMS
    VOLUME_USD
    AVERAGE_AMOUNT_USD
    DAILY_AVERAGE_SWAPS
    DAILY_AVERAGE_SWAPPERS
    1
    5680529620932101117914513198.1093196.9017754458441.6625512153.50823
    1
    77B
    8s