saeedmzn[Orca-DEX] - Top traded assets by num traders
    Updated 2025-01-05
    -- forked from [Orca-DEX] - Total @ https://flipsidecrypto.xyz/studio/queries/243b123e-8037-403b-acca-a6063e2734ab

    with swap_txns as (
    select
    tx_id,
    signers [0] trader,
    block_timestamp :: date date,
    from
    eclipse.core.fact_events
    where
    program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
    and SUCCEEDED = true
    ),
    indexes as (
    select
    tx_id,
    CAST(index || '.' || inner_index AS FLOAT) combined_index
    from
    swap_txns
    left join eclipse.core.fact_transfers using (tx_id)
    ),
    min_max_index as (
    select
    tx_id,
    min (combined_index) min_index,
    max (combined_index) max_index
    from
    indexes
    group by 1
    ),
    swap_from as (
    select
    tx_id,
    trader,
    date,
    mint from_token,
    QueryRunArchived: QueryRun has been archived