datavortexTraders per category
    Updated 2024-12-17
    WITH trader_categories AS (
    SELECT
    platform,
    origin_from_address,
    SUM(amount_in_usd) AS total_swap_volume_usd,
    COUNT(DISTINCT tx_hash) AS total_swap_count
    FROM
    kaia.defi.ez_dex_swaps
    GROUP BY
    platform, origin_from_address
    ),
    categorized_traders AS (
    SELECT
    platform,
    origin_from_address,
    total_swap_volume_usd,
    total_swap_count,
    CASE
    WHEN total_swap_volume_usd > 100000 THEN 'Whale'
    WHEN total_swap_volume_usd >= 10000 AND total_swap_volume_usd <= 99999 THEN 'Dolphin'
    WHEN total_swap_volume_usd >= 1000 AND total_swap_volume_usd < 10000 THEN 'Shark'
    WHEN total_swap_volume_usd >= 1 AND total_swap_volume_usd < 1000 THEN 'Plankton'
    WHEN total_swap_volume_usd < 1 THEN 'Micro-Plankton'
    END AS trader_category,
    CASE
    WHEN total_swap_volume_usd > 100000 THEN 1
    WHEN total_swap_volume_usd >= 10000 AND total_swap_volume_usd <= 99999 THEN 2
    WHEN total_swap_volume_usd >= 1000 AND total_swap_volume_usd < 10000 THEN 3
    WHEN total_swap_volume_usd >= 1 AND total_swap_volume_usd < 1000 THEN 4
    WHEN total_swap_volume_usd < 1 THEN 5
    END AS category_order
    FROM
    trader_categories
    )
    SELECT
    platform,
    QueryRunArchived: QueryRun has been archived