MasiShare of Users by Number of Swaps
    Updated 2025-02-02
    with tb1 as ( select trunc(block_timestamp,'day') as day,
    tx_hash,
    swapper,
    --case when amount_in_usd is null then amount_out_usd else amount_in_usd end as amount_usd,
    concat(symbol_in,'/',symbol_out) as pair,
    symbol_in,
    amount_in,
    amount_out,
    token_in,
    token_out,
    symbol_out,
    platform,
    amount_in_usd,
    amount_out_usd
    from aptos.defi.ez_dex_swaps
    --where (AMOUNT_IN_USD between AMOUNT_OUT_USD - 5000 and AMOUNT_OUT_USD + 5000) -- Credited to Abbas from old Dashboards
    where platform = 'thala'
    )
    ,
    tb2 as ( select trunc(hour,'day') as day,
    token_address,
    avg(price) as token_price
    from aptos.price.ez_prices_hourly
    group by 1,2 )
    ,
    tb3 as ( select a.*,
    amount_in_usd*b.token_price as amount_in_usd0,
    amount_out_usd*c.token_price as amount_out_usd0,
    case when symbol_in = 'USDC' then amount_in else amount_in_usd end as amount_usd0,
    case when symbol_out = 'USDC' then amount_out else amount_out_usd end as amount_usd1,
    case when amount_usd0 is null then amount_usd1 else amount_usd0 end as amount0,
    case when amount_in_usd is null then amount_out_usd else amount_in_usd end as amount1,
    case when amount0 is null then amount1 else amount0 end as amount_usd
    from tb1 a left outer join tb2 b on a.token_in = b.token_address and a.day = b.day
    left outer join tb2 c on a.token_out = c.token_address and a.day = c.day
    )
    Last run: 3 months ago
    SWAPS
    SWAPPERS
    1
    1330606
    2
    2107875
    3
    338912
    4
    429660
    5
    517054
    6
    615187
    7
    78975
    8
    87888
    9
    95403
    10
    105318
    11
    113874
    12
    123713
    13
    143014
    14
    132688
    15
    162440
    16
    152023
    17
    181799
    18
    201625
    19
    171368
    20
    341257
    20
    200B
    14s