Eman-RazTop 10 Token with the Most Seller Count
    Updated 2023-06-09
    with tab1 as (select SYMBOL_IN as "Token in", count(distinct origin_from_address) as "Seller",
    sum(amount_in_usd) as "Selling Volume", count(distinct tx_hash) as "Selling Count",
    avg(amount_in_usd) as "Average Selling Volume", median(amount_in_usd) as "Median Selling Volume",
    max(amount_in_usd) as "Maximum Selling Volume", sum(amount_in_usd)/count(distinct origin_from_address) as "Selling Volume per User"
    from avalanche.core.ez_dex_swaps
    where amount_in_usd is not null AND
    (block_timestamp::date>='{{Start_Date}}' and block_timestamp::date<='{{End_Date}}')
    group by 1),

    tab2 as (select SYMBOL_out as "Token out", count(distinct origin_from_address) as "Buyer",
    sum(amount_out_usd) as "Buying Volume", count(distinct tx_hash) as "Buying Count",
    avg(amount_out_usd) as "Average Buying Volume", median(amount_out_usd) as "Median Buying Volume",
    max(amount_out_usd) as "Maximum Buying Volume", sum(amount_out_usd)/count(distinct origin_from_address) as "Buying Volume per User"
    from avalanche.core.ez_dex_swaps
    where amount_out_usd is not null AND
    (block_timestamp::date>='{{Start_Date}}' and block_timestamp::date<='{{End_Date}}')
    group by 1)

    select "Token in" as "Token", "Buyer", "Seller" as "⭐Seller", "Buying Volume", "Selling Volume", "Buying Volume"-"Selling Volume" as "Net Volume",
    "Buying Volume"+"Selling Volume" as "Swap Volume", "Buying Count", "Selling Count", "Buying Count"+"Selling Count" as "Swap Count"
    from tab1 left join tab2 on tab1."Token in"=tab2."Token out"
    order by 3 desc
    limit 10
    Run a query to Download Data