commanderjoseph-761gwXOpen Limit Placed Overview Check
    Updated 2024-09-24

    SELECT
    tx_hash,
    origin_from_address,
    --utils.udf_hex_to_int(SUBSTR(topics[2], 3, 64)) AS position,
    --utils.udf_hex_to_int(SUBSTR(topics[3], 3, 64)) AS open_close
    FROM
    berachain.testnet.fact_event_logs
    WHERE
    origin_to_address = lower('0xb3395EeeA7701E0037bBC6Ab52953C6fB0c3326c')
    AND
    topics[0] = lower('0xa01cf225b52ea090d73bbd904b82e44b6ac935b41de9be5c19f24c34488617f7') -- OPEN LIMIT PLACED
    AND
    origin_from_address != '0x0000000000000000000000000000000000000000'
    AND
    tx_succeeded = 'TRUE'
    LIMIT
    20
    /*
    SELECT
    COUNT(DISTINCT CASE WHEN position = 0 THEN tx_hash END) AS total_shorts,
    COUNT(DISTINCT CASE WHEN position = 1 THEN tx_hash END) AS total_longs,
    COUNT(DISTINCT CASE WHEN position = 0 THEN origin_from_address END) AS total_short_traders,
    COUNT(DISTINCT CASE WHEN position = 1 THEN origin_from_address END) AS total_long_traders
    FROM
    total_position
    */


    /*SELECT
    COUNT(DISTINCT tx_hash WHERE position = 0) AS totaL_shorts,
    COUNT(DISTINCT tx_hash WHERE position = 1) AS totaL_longs,
    COUNT(DISTINCT origin_from_address WHERE position = 0) AS totaL_short_traders,
    COUNT(DISTINCT origin_from_address WHERE position = 1) AS totaL_long_traders,
    FROM
    total_position
    QueryRunArchived: QueryRun has been archived