ArioAddress Stats on Vertex Protocol
    Updated 2024-05-28
    with user_summary_1 as (
    select
    TRADER,
    TRADE_COUNT,
    ACCOUNT_AGE,
    PERP_TRADE_COUNT,
    SPOT_TRADE_COUNT,
    case when LONG_COUNT > 0 and SHORT_COUNT > 0 then 1
    else 0 end as Two_Side_Trade,
    TOTAL_USD_VOLUME,
    AVG_USD_TRADE_SIZE,
    TOTAL_FEE_AMOUNT,
    case when TOTAL_LIQUIDATION_COUNT > 0 then -1 else +1 end as "Liquidated?",
    TOTAL_LIQUIDATION_COUNT
    from arbitrum.vertex.ez_account_stats
    where TRADER is not null
    group by 1,2,3,4,5,6,7,8,9,10,11
    ),
    multiple_asset_trader as (
    select
    Trader,
    count(distinct asset) as N_Asset
    from (
    select
    TRADER,
    case when symbol in ('WBTC, WETH') then split(symbol, 'W')[1] end as Asset
    from arbitrum.vertex.ez_spot_trades
    where IS_TAKER = TRUE
    and AMOUNT is not NULL

    union all

    select
    trader,
    case
    QueryRunArchived: QueryRun has been archived