ArioVertex Shorts - Longs for each token
    Updated 2024-03-16
    with Long as (
    select
    split(symbol, '-')[0] as Symbol,
    count(distinct TX_HASH) as "# Long Trades",
    count(DISTINCT trader) as "# Long Traders",
    sum(case when IS_TAKER = 'TRUE' then zeroifnull(AMOUNT_USD) end) as Long_Volume
    from arbitrum.vertex.ez_perp_trades
    where block_timestamp > current_timestamp - interval '24 hours'
    and TRADE_TYPE = 'buy/long'
    group by 1
    order by Long_Volume desc
    ),
    short as (
    select
    split(symbol, '-')[0] as Symbol,
    count(distinct TX_HASH) as "# Shrot Trades",
    count(DISTINCT trader) as "# Shrot Traders",
    sum(case when IS_TAKER = 'TRUE' then zeroifnull(AMOUNT_USD) end) as Short_Volume
    from arbitrum.vertex.ez_perp_trades
    where block_timestamp > current_timestamp - interval '24 hours'
    and TRADE_TYPE = 'sell/short'
    group by 1
    order by Short_Volume desc
    )
    select
    Symbol,
    "# Long Trades",
    "# Shrot Trades",
    "# Long Traders",
    "# Shrot Traders",
    Long_Volume,
    Short_Volume,
    Long_Volume - Short_Volume as Net_Volume
    from long join short using(symbol)
    order by abs(Net_Volume) desc
    QueryRunArchived: QueryRun has been archived