crypto_gostSwappers Count on Thala
    Updated 2024-12-31
    WITH swap_events AS (
    SELECT
    block_timestamp,
    tx_hash,
    swapper AS user_address,
    nvl(amount_in_usd, amount_out_usd) AS amount_usd
    FROM aptos.defi.ez_dex_swaps
    WHERE event_address = '0x48271d39d0b05bd6efca2278f22277d6fcc375504f9839fd73f74ace240861af'
    AND block_timestamp >= current_date - INTERVAL '60 days'
    ),
    user_swap_counts AS (
    SELECT
    user_address,
    COUNT(*) AS swap_count
    FROM
    swap_events
    GROUP BY
    user_address
    )
    SELECT
    (SELECT COUNT(DISTINCT user_address) FROM swap_events) AS total_swappers_last_60_days,
    COUNT(DISTINCT CASE WHEN swap_count > 5 THEN user_address END) AS active_users_last_60_days,
    AVG(swap_count) AS avg_swaps_per_user_last_60_days,
    SUM(swap_count) AS total_swaps_last_60_days
    FROM
    user_swap_counts;


    Last run: about 2 months ago
    TOTAL_SWAPPERS_LAST_60_DAYS
    ACTIVE_USERS_LAST_60_DAYS
    AVG_SWAPS_PER_USER_LAST_60_DAYS
    TOTAL_SWAPS_LAST_60_DAYS
    1
    384171343071.67152753404
    1
    31B
    2s