Eman-RazDistribution of PEPE Swappers Based on the Swap Volume($USD)
    Updated 2023-07-10
    with pepe_ as (with final_tab as
    (WITH SELL AS (select origin_from_address, sum(amount_in_usd) as SELLING_VOLUME, count(distinct tx_hash) as selling_count
    from ethereum.core.ez_dex_swaps
    where TOKEN_IN=lower('0x6982508145454Ce325dDbE47a25d4ec3d2311933') --OR -- PEPE
    --TOKEN_IN=lower('0x6B89B97169a797d94F057F4a0B01E2cA303155e4') OR --CHAD
    --TOKEN_IN=lower('0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce')) -- SHIB
    group by 1
    order by 1),

    BUY AS (select origin_from_address, sum(amount_OUT_usd) as BUYING_VOLUME, count(distinct tx_hash) as BUYING_count
    from ethereum.core.ez_dex_swaps
    where TOKEN_out=lower('0x6982508145454Ce325dDbE47a25d4ec3d2311933') --OR -- PEPE
    --TOKEN_out=lower('0x6B89B97169a797d94F057F4a0B01E2cA303155e4') OR --CHAD
    --TOKEN_out=lower('0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce')) -- SHIB
    group by 1
    order by 1)

    SELECT SELL.origin_from_address as "Swapper", SELLING_VOLUME, BUYING_VOLUME, selling_count, BUYING_count, CASE
    WHEN SELLING_VOLUME IS NULL THEN 0
    ELSE SELLING_VOLUME
    END AS "Selling Volume", case
    WHEN BUYING_VOLUME IS NULL THEN 0
    ELSE BUYING_VOLUME
    END AS "Buying Volume", case
    when selling_count is null then 0
    else selling_count
    end as "Selling Count", case
    when buying_count is null then 0
    else buying_count
    end as "Buying Count"
    from sell left join buy on sell.origin_from_address=buy.origin_from_address
    order by 1)

    select "Swapper", "Selling Volume"+"Buying Volume" as "⭐Swap Volume", case
    when (("Selling Volume")+("Buying Volume"))<=1 then 'V<=1'
    when (("Selling Volume")+("Buying Volume"))>1 AND (("Selling Volume")+("Buying Volume"))<=10 then '1<V<=10'
    Run a query to Download Data