0xHaM-dSwap || New vs Recurring Traders
    Updated 2025-02-23
    with swapEvent as (
    select
    block_timestamp,
    platform,
    tx_hash,
    ORIGIN_FROM_ADDRESS as user,
    symbol_in,
    symbol_out,
    amount_in_usd,
    amount_out_usd,
    nvl(amount_in_usd, amount_out_usd) as amount_usd
    from kaia.defi.ez_dex_swaps
    WHERE platform ilike 'klayswap%'
    )
    ,DAU_u as (
    SELECT
    date_trunc('day', BLOCK_TIMESTAMP) as dt,
    count(DISTINCT user) as Active_users
    FROM swapEvent
    GROUP BY 1
    )
    ,new as (
    SELECT
    date_trunc('day', first_tx) as dt,
    count(DISTINCT user) as new_user
    FROM (
    SELECT
    user,
    min(block_timestamp) as first_tx
    FROM swapEvent
    GROUP BY 1
    )
    GROUP BY 1
    )

    SELECT
    QueryRunArchived: QueryRun has been archived