Query editor
WITH total_buys AS (SELECTtrader_id,SUM(amount_usd) AS total_buy_amountFROM dex_solana.tradesWHEREtoken_bought_symbol IN ('SOL')and project='pumpdotfun'AND token_sold_mint_address = 'WbD8bHXCLQCi7RmYGg38qQKYsQ52ErZhNPx78oLpump' /* Filter for token_sold_mint_address ending with 'pump' */GROUP BYtrader_id), total_sells AS (SELECTtrader_id,SUM(amount_usd) AS total_sell_amountFROM dex_solana.tradesWHEREtoken_sold_symbol IN ('SOL')and project='pumpdotfun'AND token_bought_mint_address = 'WbD8bHXCLQCi7RmYGg38qQKYsQ52ErZhNPx78oLpump' /* Filter for token_bought_mint_address ending with 'pump' */GROUP BYtrader_id)SELECTb.trader_id,COALESCE(b.total_buy_amount, 0) AS total_buy_amount,COALESCE(s.total_sell_amount, 0) AS total_sell_amount,COALESCE(s.total_sell_amount, 0) - COALESCE(b.total_buy_amount, 0) AS pnlFROM total_buys AS bJOIN total_sells AS sON b.trader_id = s.trader_idORDER BYpnl DESCLIMIT 5000