Query editor
WITH marketMapping AS (SELECTam.account_market AS market,CONCAT(CASE-- Wrapped crypto → unwrapped display namesWHEN tk.symbol = 'WSOL' THEN 'SOL'WHEN tk.symbol = 'WBTC' THEN 'BTC'WHEN tk.symbol = 'WETH' THEN 'ETH'-- Special chars / casing fixesWHEN tk.symbol = '$WIF' THEN 'WIF'WHEN tk.symbol = 'Bonk' THEN 'BONK'WHEN tk.symbol = 'Fartcoin' THEN 'FARTCOIN'-- Symbol exists and is fine as-isWHEN tk.symbol IS NOT NULL THEN tk.symbol-- No token table entry → mint prefix matchingWHEN ac.account_custodyTokenMint LIKE 'XAUfcd%' THEN 'XAU'WHEN ac.account_custodyTokenMint LIKE 'XAGLict%' THEN 'XAG'WHEN ac.account_custodyTokenMint LIKE 'GBPvXs%' THEN 'GBP'WHEN ac.account_custodyTokenMint LIKE 'EURPnve%' THEN 'EUR'WHEN ac.account_custodyTokenMint LIKE 'JPYPFUB%' THEN 'USDJPY'WHEN ac.account_custodyTokenMint LIKE 'o1Lw5dj%' THEN 'USDCNH'WHEN ac.account_custodyTokenMint LIKE 'CNHShWx%' THEN 'USDCNH'WHEN ac.account_custodyTokenMint LIKE 'BNBXen%' THEN 'BNB'WHEN ac.account_custodyTokenMint LIKE 'AUDdbs%' THEN 'AUD'-- Fallback: show first 8 chars of mintELSE SUBSTR(ac.account_custodyTokenMint, 1, 8)END,' ',json_extract_scalar(am.params, '$.AddMarketParams.side.Side')) AS marketNameFROM flash_trade_solana.perpetuals_call_addmarket amLEFT JOIN flash_trade_solana.perpetuals_call_addcustody acON am.account_targetCustody = ac.account_custodyLEFT JOIN tokens_solana.fungible tkON ac.account_custodyTokenMint = tk.token_mint_address),all_liquidations AS (-- V4 (LiquidateLogUSDv1)SELECTblock_time,tx_id,to_base58(bytearray_substring(data,1+48,32)) AS market,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+128,8))) / 1e6 AS sizeUsdFROM solana.instruction_callsWHERE block_time >= TIMESTAMP '2025-10-01'AND executing_account = 'FLASH6Lo6h3iasJKWDs2F8TkW2UKf3s15C8PMGuVfgBn'AND bytearray_substring(data,1+8,8) = 0x3a6f6c0ff4cb6b46AND tx_success = trueUNION ALL-- V3 (LiquidateLogV3)SELECTblock_time,tx_id,to_base58(bytearray_substring(data,1+48,32)) AS market,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+120,8))) / 1e6 AS sizeUsdFROM solana.instruction_callsWHERE block_time >= TIMESTAMP '2024-09-06 10:37'