Query editor
WITH token_launches AS (SELECTtoken_bought_address AS token,MIN(block_time) AS launch_timeFROM dex.tradesWHERE blockchain = 'ethereum'AND block_time >= NOW() - INTERVAL '90' DAYAND amount_usd > 10AND token_bought_amount > 0GROUP BY 1),early_buys AS (SELECTt.taker AS wallet,t.token_bought_address AS token,t.token_bought_symbol AS symbol,t.block_time,t.amount_usd,t.amount_usd / NULLIF(t.token_bought_amount, 0) AS buy_priceFROM dex.trades tJOIN token_launches lON t.token_bought_address = l.tokenWHERE t.blockchain = 'ethereum'AND t.block_time >= NOW() - INTERVAL '90' DAYAND t.block_time <= l.launch_time + INTERVAL '72' HOURAND t.amount_usd > 100AND t.token_bought_amount > 0),token_peaks AS (SELECTtoken_bought_address AS token,MAX(amount_usd / NULLIF(token_bought_amount, 0)) AS peak_priceFROM dex.tradesWHERE blockchain = 'ethereum'AND block_time >= NOW() - INTERVAL '90' DAYAND amount_usd > 50AND token_bought_amount > 0GROUP BY 1),winners AS (SELECTeb.wallet,eb.token,eb.symbol,eb.buy_price,tp.peak_price,tp.peak_price / NULLIF(eb.buy_price, 0) AS max_multiple,eb.amount_usd AS buy_size_usdFROM early_buys ebJOIN token_peaks tp ON eb.token = tp.tokenWHERE tp.peak_price / NULLIF(eb.buy_price, 0) >= 3)SELECTwallet,COUNT(DISTINCT token) AS winning_early_buys,ROUND(AVG(max_multiple), 1) AS avg_max_multiple,