Query editor
WITH token_creations AS (SELECTcall_tx_signer,account_mint,call_block_date,ROW_NUMBER() OVER (PARTITION BY call_tx_signer ORDER BY call_block_date DESC) AS rank,ROW_NUMBER() OVER (PARTITION BY call_tx_signer ORDER BY call_block_date DESC) AS token_numberFROMpumpdotfun_solana.pump_call_createWHEREcall_instruction_name = 'create'AND call_block_date >= CURRENT_DATE - INTERVAL '1' DAY -- Filter for the past week),filtered_creators AS (SELECTcall_tx_signer,COUNT(DISTINCT account_mint) AS distinct_tokens_mintedFROMtoken_creationsGROUP BYcall_tx_signerHAVINGCOUNT(DISTINCT account_mint) < 200),token_trades AS (SELECTtoken_bought_mint_address AS token_mint_address,SUM(CASE WHEN token_bought_mint_address IS NOT NULL THEN amount_usd ELSE 0 END) AS buy_volume_usd,SUM(CASE WHEN token_sold_mint_address IS NOT NULL THEN amount_usd ELSE 0 END) AS sell_volume_usdFROMdex_solana.tradesWHEREtoken_bought_mint_address IN (SELECT DISTINCT account_mint FROM token_creations)OR token_sold_mint_address IN (SELECT DISTINCT account_mint FROM token_creations)GROUP BYtoken_bought_mint_address)SELECTtc.call_tx_signer,tc.account_mint,tc.call_block_date,tc.token_number,COALESCE(tt.buy_volume_usd, 0) + COALESCE(tt.sell_volume_usd, 0) AS total_volume_usdFROMtoken_creations tcJOINfiltered_creators fc ON tc.call_tx_signer = fc.call_tx_signerLEFT JOINtoken_trades tt ON tt.token_mint_address = tc.account_mintWHEREtc.rank <= 2 -- Get the latest 5 tokensGROUP BYtc.call_tx_signer,tc.account_mint,tc.call_block_date,tc.token_number,tt.buy_volume_usd,tt.sell_volume_usd,tc.rank -- Include rank in GROUP BYHAVING