Query editor
WITH -- Step 1: What's active in last 48hrsrecent_activity AS (SELECTtoken_bought_mint_address,token_bought_symbol,COUNT(*) as trades_last_48hr,SUM(amount_usd) as volume_usd,COUNT(DISTINCT trader_id) as unique_buyers,MIN(block_time) as came_alive_atFROM dex_solana.tradesWHERE block_time >= date_add('hour', -48, NOW())AND project IN ('pumpdotfun', 'pumpswap')AND amount_usd > 0AND token_bought_symbol != 'WSOL'GROUP BY token_bought_mint_address, token_bought_symbolHAVING COUNT(*) > 100AND COUNT(DISTINCT trader_id) > 100AND SUM(amount_usd) > 5000),-- Step 2: How active was it during the "dead" window (2-9 days ago)dead_period AS (SELECTtoken_bought_mint_address,COUNT(*) as trades_while_deadFROM dex_solana.tradesWHERE block_time BETWEEN date_add('day', -9, NOW())AND date_add('hour', -48, NOW())AND project IN ('pumpdotfun', 'pumpswap')AND amount_usd > 0GROUP BY token_bought_mint_address),-- Step 3: Token's all time birth (how old is it really)token_age AS (SELECTtoken_bought_mint_address,MIN(block_time) as all_time_first_tradeFROM dex_solana.tradesWHERE block_time >= date_add('day', -180, NOW())AND project IN ('pumpdotfun', 'pumpswap')AND amount_usd > 0GROUP BY token_bought_mint_address)SELECTr.token_bought_mint_address,r.token_bought_symbol,r.trades_last_48hr,ROUND(r.volume_usd, 2) as volume_usd,r.unique_buyers,r.came_alive_at,a.all_time_first_trade,DATE_DIFF('day', a.all_time_first_trade, NOW()) as token_age_days,-- How dead was it before revivalCOALESCE(d.trades_while_dead, 0) as trades_while_dead,-- Revival strength scoreROUND(