elsina2024-07-07: Long and Short positions based on token
    Updated 2024-09-30
    SELECT
    date_trunc('day', block_timestamp) as date,
    'long' as position,
    COUNT(DISTINCT tx_hash) AS transaction_count,
    COUNT(DISTINCT trader) AS unique_trader_count,
    SUM(amount_usd) AS transaction_volume,
    FROM
    arbitrum.vertex.ez_perp_trades
    WHERE
    is_taker = true and
    trade_type = 'buy/long' and
    symbol = '{{token_name}}' and
    date >= '2024-01-01'
    group by date

    union

    SELECT
    date_trunc('day', block_timestamp) as date,
    'short' as position,
    COUNT(DISTINCT tx_hash) AS transaction_count,
    COUNT(DISTINCT trader) AS unique_trader_count,
    -SUM(amount_usd) AS transaction_volume,
    FROM
    arbitrum.vertex.ez_perp_trades
    WHERE
    is_taker = true and
    trade_type = 'sell/short' and
    symbol = '{{token_name}}' and
    date >= '2024-01-01'
    group by date



    QueryRunArchived: QueryRun has been archived