Query by @astrolabe-pumpfun, updated 2026-11-05. #pumpfun #pnl #traders #wallets
Example query
WITH
pos AS (
SELECT
toStringCutToZero(signing_wallet) AS wallet,
toStringCutToZero(base_coin) AS mint,
sumIf(quote_coin_amount, direction = 'buy') / 1e9 AS sol_in,
sumIf(quote_coin_amount, direction = 'sell') / 1e9 AS sol_out,
sumIf(base_coin_amount, direction = 'buy') AS tok_bought,
sumIf(base_coin_amount, direction = 'sell') AS tok_sold,
count() AS trades,
sum(fee) / 1e9 AS fees_sol,
any(transform(parent_program,
['', 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4', 'DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH',
'T1TANpTeScyeqVzzgNViGDNrkQ6qHz9KrSBS4aNXvGT', 'GMGNreQcJFufBiCTLDBgKhYEfEe9B454UjpDr5CaSLA1',
'GMgnVFR8Jb39LoXsEVzb3DvBy3ywCmdmJquHUy1Lrkqb', 'MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e'],
['direct call', 'Jupiter', 'DFlow', 'Titan', 'GMGN', 'GMGN', 'Pump.fun Mayhem'],
concat(substring(parent_program, 1, 6), '…'))) AS router
FROM pumpfun_v2_swaps
WHERE failed = 0 AND block_date_utc >= toDate((SELECT max(block_time) FROM solana_blocks) - INTERVAL {{hours}} HOUR) AND block_time > (SELECT max(block_time) FROM solana_blocks) - INTERVAL {{hours}} HOUR AND block_time <= (SELECT max(block_time) FROM solana_blocks)
GROUP BY wallet, mint
),
last_state AS (
-- the curve's virtual reserves after the token's last trade in the window
SELECT toStringCutToZero(base_coin) AS mint,
argMax(virtual_sol_balance_after, (block_time, slot, tx_idx)) AS vsol,
argMax(virtual_token_balance_after, (block_time, slot, tx_idx)) AS vtok
FROM pumpfun_v2_swaps
WHERE failed = 0 AND block_date_utc >= toDate((SELECT max(block_time) FROM solana_blocks) - INTERVAL {{hours}} HOUR) AND block_time > (SELECT max(block_time) FROM solana_blocks) - INTERVAL {{hours}} HOUR AND block_time <= (SELECT max(block_time) FROM solana_blocks) AND virtual_token_balance_after > 0
GROUP BY mint
),
position AS (
SELECT wallet, mint, sol_in, sol_out, trades, fees_sol, router,
greatest(tok_bought - tok_sold, 0) AS tok_left,
-- what selling the remaining tokens into the curve would return now: constant product, minus the 1% fee
if(tok_left > 0, toFloat64(vsol) * tok_left / (toFloat64(vtok) + tok_left) / 1e9 * 0.99, 0) AS held_sol,
sol_out - sol_in AS realized_sol,
sol_out - sol_in + held_sol AS pnl_sol
FROM pos
LEFT JOIN last_state USING mint
),
wallets AS (
SELECT wallet,
sum(pnl_sol) AS pnl,
sum(realized_sol) AS realized,
sum(held_sol) AS held,
sum(sol_in) + sum(sol_out) AS volume,
sum(sol_in) AS bought,
sum(trades) AS n_trades,
count() AS n_tokens,
countIf(pnl_sol > 0) AS n_tokens_won,
sum(fees_sol) AS fees,
argMax(router, trades) AS main_router,
-- a signer with thousands of tokens in a day is a bundler or relayer signing for other people, not a trader
(sum(trades) > 50000 OR count() > 3000) AS infra
FROM position
GROUP BY wallet
)
SELECT
multiIf(bought = 0, 'sells only (bought earlier)', n_trades = 1, 'one trade', n_trades <= 5, '2–5 trades', n_trades <= 20, '6–20 trades', n_trades <= 100, '21–100 trades', 'over 100 trades') AS activity,
count() AS wallets,
round(countIf(pnl > 0) / count() * 100, 1) AS winners_pct,
round(median(pnl), 3) AS median_pnl_sol,
round(avg(pnl), 3) AS mean_pnl_sol,
round(sum(pnl)) AS total_pnl_sol,
round(sum(volume)) AS volume_sol,
round(sum(fees), 1) AS tx_fees_sol
FROM wallets
GROUP BY activity
ORDER BY min(if(bought = 0, toInt64(-1), toInt64(n_trades)))Charts: Share of wallets in profit, by activity, Total PnL by activity, SOL.
| activity | wallets | winners_pct | median_pnl_sol | mean_pnl_sol | total_pnl_sol | volume_sol | tx_fees_sol |
|---|---|---|---|---|---|---|---|
| sells only (bought earlier) | 11700 | 100.0 | 0.124 | 32.36 | 378616.0 | 378616.0 | 5.2 |
| one trade | 20765 | 55.9 | 0.005 | 2.02 | 41949.0 | 161089.0 | 6.6 |
| 2–5 trades | 64205 | 47.6 | -0.0 | 0.028 | 1781.0 | 2272054.0 | 54.1 |
| 6–20 trades | 39063 | 45.2 | -0.0 | 11.055 | 431849.0 | 6230764.0 | 130.9 |
| 21–100 trades | 16959 | 49.8 | -0.001 | 41.381 | 701778.0 | 20391133.0 | 330.5 |
| over 100 trades | 4803 | 56.5 | 0.306 | -1.537 | -7383.0 | 43930909.0 | 994.1 |
6 rows. Computed 2026-11-05T13:17:04Z.