Eman-RazTop 5 SEI Traders Based on the Volume
    Updated 2024-05-29
    with tab3 as (with tab1 as (select swapper, sum(amount_in)/pow(10,6) as swap_volume, count(distinct tx_id) as swap_count
    from sei.defi.fact_dex_swaps
    where currency_in='usei' and tx_succeeded='true'
    group by 1),

    tab2 as (select swapper, sum(amount_out)/pow(10,6) as swap_volume, count(distinct tx_id) as swap_count
    from sei.defi.fact_dex_swaps
    where currency_out='usei' and tx_succeeded='true'
    group by 1)

    select * from tab1 union all
    select * from tab2)

    select swapper as "Trader", round(sum(swap_volume)) as "Swap Volume (SEI)" , sum(swap_count) as "Swap Count"
    from tab3
    group by 1
    order by 2 desc
    limit 5
    QueryRunArchived: QueryRun has been archived