Query editor
WITH pnl_data AS (SELECT*FROM dune.hanyon_analytics.result_meteora_damm_v_2_lp_add_remove_claim_pn_l_table_v_2WHERE token_B_mint = 'So11111111111111111111111111111111111111112'AND pnl_pct IS NOT NULL),win_stats AS (SELECTMAX(remove_liq_time) AS last_active,user_address,COUNT(*) AS total_trades,ROUND(COUNT_IF(pnl_pct > 0) * 100.0 / COUNT(*), 2) AS win_rate_pct,ROUND(SUM((COALESCE(token_B_remove, 0) + COALESCE(token_B_claimed, 0)) - token_B_add), 4) AS pnl_sol,ROUND(AVG(token_B_add), 4) AS avg_sol_deposited,COUNT_IF(pnl_pct > 0) AS wins,COUNT_IF(pnl_pct <= 0) AS lossesFROM pnl_dataGROUP BY user_address)SELECT *FROM win_statsORDER BY last_active DESC