Updated 2024-12-12
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    least(amount_in_usd, amount_out_usd) as amount_usd,
    swapper,
    symbol_in,
    symbol_out
    from
    aptos.defi.ez_dex_swaps
    where
    platform = 'sushi'
    )

    select
    count(distinct swapper) as total_swappers,
    count(distinct tx_hash) as total_swaps,
    sum(amount_usd) as total_volume_usd,
    avg(amount_usd) as average_amount_usd,
    median(amount_usd) as median_amount_usd,
    total_swappers / total_swaps as average_number_of_swaps_per_user
    from
    main
    QueryRunArchived: QueryRun has been archived