Query editor
-- Hourly Trader Realized PnL — GMX V2 BTC/USD market (Arbitrum)-- Period: backtest window 2024-06-02 … 2026-03-28-- Used to identify hours with concentrated LP-loss events (single big closes)-- base_pnl_usd: positive = trader profit (pool loss), negative = trader loss (pool gain)SELECTdate_trunc('hour', block_time) AS ts_hour,COUNT(*) AS n_closes,SUM(base_pnl_usd) AS sum_pnl_usd,SUM(IF(base_pnl_usd > 0, base_pnl_usd, 0)) AS trader_profit_usd,SUM(IF(base_pnl_usd < 0, base_pnl_usd, 0)) AS trader_loss_usd,MAX(base_pnl_usd) AS max_close_pnl_usd,MIN(base_pnl_usd) AS min_close_pnl_usd,APPROX_PERCENTILE(base_pnl_usd, 0.95) AS p95_close_pnl_usd,CASE WHEN SUM(IF(base_pnl_usd > 0, base_pnl_usd, 0)) > 0THEN MAX(base_pnl_usd) / SUM(IF(base_pnl_usd > 0, base_pnl_usd, 0))ELSE NULL END AS max_close_share_of_profitFROM gmx_v2.position_decreaseWHERE blockchain = 'arbitrum'AND market = 0x47c031236e19d024b42f8ae6780e44a573170703AND block_time >= TIMESTAMP '2024-06-02 00:00'AND block_time < TIMESTAMP '2026-03-28 00:00'GROUP BY 1ORDER BY 1