Query editor
WITH pump_tokens AS (SELECTtr.token_mint_address,amount/power(10,6) AS total_supply,tx_signer AS token_creator,MIN(block_time) AS creation_dateFROM tokens_solana.transfers trWHERE action = 'mint'AND outer_executing_account = '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P' --pump.fun programAND tr.token_mint_address IS NOT NULLAND block_time >= date_add('day', -{{days_interval}}, current_date)GROUP BY tr.token_mint_address, amount, tx_signer),all_time_high_prices AS (SELECTa.token_bought_mint_address,MAX(a.amount_usd/a.token_bought_amount) AS max_price_usdFROM dex_solana.trades aINNER JOIN pump_tokens b ON a.token_bought_mint_address = b.token_mint_addressWHERE a.amount_usd IS NOT NULLAND a.token_bought_symbol IS NOT NULLAND a.token_bought_symbol != 'COOL💹'AND a.project = 'raydium'AND a.block_time >= date_add('day', -{{days_interval}}, current_date)GROUP BY a.token_bought_mint_address),token_info AS (SELECTa.token_bought_mint_address,a.token_bought_symbol AS symbol,a.project,a.amount_usd/a.token_bought_amount AS price_usd,ROW_NUMBER() OVER (PARTITION BY a.token_bought_mint_address ORDER BY a.amount_usd/a.token_bought_amount DESC) AS rnFROM dex_solana.trades aINNER JOIN all_time_high_prices h ON a.token_bought_mint_address = h.token_bought_mint_addressWHERE a.amount_usd/a.token_bought_amount = h.max_price_usd)SELECTp.token_mint_address AS token,p.token_creator,p.creation_date,t.symbol,p.total_supply * h.max_price_usd AS ath_fdvFROM pump_tokens pINNER JOIN all_time_high_prices h ON p.token_mint_address = h.token_bought_mint_addressINNER JOIN token_info t ON p.token_mint_address = t.token_bought_mint_address AND t.rn = 1WHERE h.max_price_usd < 0.5AND t.project != 'pumpdotfun'AND p.token_mint_address != '5rTp9dW8ZQL4AKRmGLHhPu7vb14ZXXX5Gb2qF1Vnpump'AND is_finite(p.total_supply * h.max_price_usd) -- Filter out infinity valuesAND p.total_supply * h.max_price_usd > 0 -- Filter out zero valuesORDER BY ath_fdv DESC