Query editor
-- ============================================================-- QUERY 40B-- FULL TX × MINT NET-FLOW LEDGER---- SOURCE:-- query_8682112 = Q40A raw DEX legs---- PURPOSE:-- 1. expand bought/sold sides into signed mint flows-- 2. net by wallet × tx × mint-- 3. calculate residual_ratio-- 4. apply fixed materiality threshold 0.001---- NO USD-- NO PnL-- NO historical prices-- NO H=14-- ============================================================WITH signed_flows AS (-- ---------------------------------------------------------- BOUGHT SIDE = received = positive flow-- --------------------------------------------------------SELECTtrader_id,tx_id,block_time,token_bought_mint_address AS mint,CAST(token_bought_amount AS DOUBLE)AS signed_amount,ABS(CAST(token_bought_amount AS DOUBLE))AS gross_amountFROM query_8682112WHERE token_bought_mint_address IS NOT NULLAND token_bought_amount IS NOT NULLUNION ALL-- ---------------------------------------------------------- SOLD SIDE = sent = negative flow-- --------------------------------------------------------SELECTtrader_id,tx_id,block_time,token_sold_mint_address AS mint,-CAST(token_sold_amount AS DOUBLE)