Query editor
-- GRADLAB Q3 v2: one summary row per real graduation (PumpSwap era, full-history pull)-- Slimmed for cost: PumpSwap-only trades table, 2-day curve lookback, 24h follow-up window.-- Parameters: {{start}} and {{end}} as dates (end exclusive). Run a month at a time.-- Prices are ratios to the first post-graduation trade price (r = 1.0 at T0).-- r_1m etc. = last trade price at or before that checkpoint (exact on-chain order).WITH curve AS (SELECTIF(token_bought_mint_address = 'So11111111111111111111111111111111111111112',token_sold_mint_address, token_bought_mint_address) AS mint,block_time,trader_id,token_sold_mint_address = 'So11111111111111111111111111111111111111112' AS is_buy,IF(token_sold_mint_address = 'So11111111111111111111111111111111111111112',token_sold_amount, token_bought_amount) AS solFROM pumpdotfun_solana.tradesWHERE block_month >= date_trunc('month', DATE '{{start}}' - INTERVAL '2' DAY)AND block_month <= DATE '{{end}}'AND block_time >= CAST('{{start}}' AS TIMESTAMP) - INTERVAL '2' DAYAND block_time < CAST('{{end}}' AS TIMESTAMP)),curve_stats AS (SELECTmint,MIN(block_time) AS first_curve_trade,MAX(block_time) AS last_curve_trade,COUNT(*) AS curve_trades,COUNT(DISTINCT IF(is_buy, trader_id)) AS curve_buyers,SUM(IF(is_buy, sol, 0)) AS curve_buy_sol,SUM(IF(NOT is_buy, sol, 0)) AS curve_sell_sol,MIN_BY(trader_id, block_time) AS first_trader,MIN_BY(sol, block_time) AS first_trade_solFROM curveGROUP BY 1HAVING MAX(block_time) >= CAST('{{start}}' AS TIMESTAMP)AND SUM(IF(is_buy, sol, -sol)) >= 40 -- real graduations only),amm AS (SELECTIF(token_bought_mint_address = 'So11111111111111111111111111111111111111112',token_sold_mint_address, token_bought_mint_address) AS mint,project,block_time,-- exact on-chain order (many trades share a second): slot, then position in blockblock_slot * 1000000 + tx_index * 100 + COALESCE(outer_instruction_index, 0) AS seq,trader_id,amount_usd,token_sold_mint_address = 'So11111111111111111111111111111111111111112' AS is_buy,IF(token_sold_mint_address = 'So11111111111111111111111111111111111111112',token_sold_amount, token_bought_amount) AS sol,IF(token_sold_mint_address = 'So11111111111111111111111111111111111111112',token_sold_amount / NULLIF(token_bought_amount, 0),token_bought_amount / NULLIF(token_sold_amount, 0)) AS price_solFROM pumpswap_solana.trades -- PumpSwap only: far smaller than dex_solana.tradesWHERE block_month >= date_trunc('month', DATE '{{start}}')AND block_month <= DATE '{{end}}' + INTERVAL '2' DAYAND block_time >= CAST('{{start}}' AS TIMESTAMP)AND block_time < CAST('{{end}}' AS TIMESTAMP) + INTERVAL '25' HOURAND 'So11111111111111111111111111111111111111112'IN (token_bought_mint_address, token_sold_mint_address)),