PumpFun Trade Events ​
Real-time trade events for tokens traded on the PumpFun platform, providing buy and sell transaction data.
Overview ​
The PumpFun trade events WebSocket stream provides real-time notifications of buy and sell transactions as they occur on-chain.
Connection ​
WebSocket Endpoint:
wss://api.nolimitnodes.com/socket?apikey=YOUR_API_KEY
1
Subscription ​
Subscribe Request ​
json
{
"method": "dataSubscribe",
"params": {
"referenceId": "PUMP_TRADES",
"streams": [
{
"stream": "pumpFunTradesSubscribe",
"params": {
"token": "2M4QNeba4PAorsCmi6gkg3Gn7NvBqnL9A6BTj9zApump",
"wallet": "GPSwijrmxy7ChMHB1P8YSp5sa5Rsj4bYnrTZYF4Ydbow",
"isBuy": true
}
}
]
},
"id": 1
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Filter Parameters ​
Parameter | Type | Required | Description |
---|---|---|---|
token | string | No | Token mint address to filter |
wallet | string | No | Filter by specific trader wallet |
isBuy | boolean | No | Filter by trade type (true for buys only, false for sells only) |
programId | string | No | Filter by PumpFun program ID |
Response Messages ​
Subscription Confirmation ​
json
{
"status": "Subscribed to pumpFunTrades",
"subscription_id": "92786463-56b4-4473-9237-e910b1a89338",
"stream": "pumpFunTradesSubscribe",
"reference_id": "PUMP_TRADES"
}
1
2
3
4
5
6
2
3
4
5
6
Trade Event Data ​
json
{
"method": "pumpFunTradesSubscribe",
"subscription_id": "41af7023-770c-47ac-b5f4-fec72d3d625a",
"result": {
"wallet": "GPSwijrmxy7ChMHB1P8YSp5sa5Rsj4bYnrTZYF4Ydbow",
"amountInSol": 48888888,
"amountInToken": 1042845568388,
"changeInSol": -48888888,
"changeInTokens": 1042845568388,
"isBuy": true,
"token": "2M4QNeba4PAorsCmi6gkg3Gn7NvBqnL9A6BTj9zApump",
"transactionSignature": "42NgPvXbRHZc5Ec739F8iw9sYUHeRVf5umGYREAvDzDqmYTdmsxeT8Xfn2AMb341JfUdDj4sU74kcLm71uvRDyMS",
"blockNum": "366365160",
"blockTime": "1757694938",
"programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
"type": "trade",
"virtualSolReserves": 38871280681,
"virtualTokenReserves": 828117817602406,
"realSolReserves": 8871280681,
"realTokenReserves": 548217817602406,
"feeRecipient": "62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV",
"feeBasisPoints": 95,
"fee": 464445,
"creator": "Ar3EMLHmDmsCuniER8G72vYc7VMcAZfMhbGKtSf35c7",
"creatorFeeBasisPoints": 30,
"creatorFee": 146667,
"priceInSol": "0.0000000469"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Field Descriptions ​
wallet
: Wallet address that executed the tradeamountInSol
: SOL amount involved in the trade (in lamports)amountInToken
: Token amount involved in the tradechangeInSol
: SOL balance change (negative for buys, positive for sells)changeInTokens
: Token balance change (positive for buys, negative for sells)isBuy
: Trade type (true = buy, false = sell)token
: Token mint addresstransactionSignature
: Solana transaction signatureblockNum
: Block numberblockTime
: Unix timestampprogramId
: PumpFun program IDtype
: Event type ("trade")virtualSolReserves
: Virtual SOL reservesvirtualTokenReserves
: Virtual token reservesrealSolReserves
: Real SOL reservesrealTokenReserves
: Real token reservesfeeRecipient
: Fee recipient addressfeeBasisPoints
: Trading fee in basis pointsfee
: Fee amount in lamportscreator
: Token creator addresscreatorFeeBasisPoints
: Creator fee in basis pointscreatorFee
: Creator fee amount in lamportspriceInSol
: Token price in SOL
Unsubscribe ​
To stop receiving trade events, use the dataUnsubscribe
method with the subscription ID received during subscription:
Unsubscribe Request ​
json
{
"method": "dataUnsubscribe",
"params": {
"subscriptionIds": ["your_subscription_id_here"],
"referenceId": "UNSUB_REF"
}
}
1
2
3
4
5
6
7
2
3
4
5
6
7
Unsubscribe Response ​
json
{
"status": "Unsubscribed from pumpFunTrades",
"subscription_id": "your_subscription_id_here",
"stream": "pumpFunTradesSubscribe",
"reference_id": "UNSUB_REF"
}
1
2
3
4
5
6
2
3
4
5
6
Parameters ​
Parameter | Type | Required | Description |
---|---|---|---|
subscriptionIds | array | Yes | Array of subscription IDs to unsubscribe |
referenceId | string | No | Reference ID for tracking the request |
Code Examples ​
JavaScript/Node.js ​
javascript
const WebSocket = require('ws');
class PumpFunTradeMonitor {
constructor(apiKey) {
this.apiKey = apiKey;
this.ws = null;
}
connect() {
this.ws = new WebSocket(`wss://api.nolimitnodes.com/socket?apikey=${this.apiKey}`);
this.ws.on('open', () => {
console.log('Connected to PumpFun trades');
this.subscribe();
});
this.ws.on('message', (data) => {
const message = JSON.parse(data);
if (message.method === 'pumpFunTradesSubscribe') {
this.processTrade(message.result);
}
});
}
subscribe() {
this.ws.send(JSON.stringify({
method: 'dataSubscribe',
params: {
referenceId: 'PUMP_TRADES',
streams: [{
stream: 'pumpFunTradesSubscribe',
params: {}
}]
}
}));
}
processTrade(trade) {
const tradeType = trade.isBuy ? 'BUY' : 'SELL';
const solAmount = trade.amountInSol / 1e9; // Convert lamports to SOL
console.log(`\n[${tradeType}] ${trade.token.slice(0, 8)}...`);
console.log(` Wallet: ${trade.wallet.slice(0, 8)}...`);
console.log(` SOL: ${solAmount.toFixed(4)}`);
console.log(` Tokens: ${trade.amountInToken.toLocaleString()}`);
console.log(` Price: ${trade.priceInSol} SOL`);
console.log(` Block: ${trade.blockNum}`);
}
}
// Usage
const monitor = new PumpFunTradeMonitor('YOUR_API_KEY');
monitor.connect();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Python ​
python
import json
import asyncio
import websockets
from datetime import datetime
from collections import defaultdict
class PumpFunTradeMonitor:
def __init__(self, api_key):
self.api_key = api_key
self.uri = f"wss://api.nolimitnodes.com/socket?apikey={api_key}"
async def connect(self):
self.websocket = await websockets.connect(self.uri)
print("Connected to PumpFun trade stream")
async def subscribe(self):
subscription = {
"method": "dataSubscribe",
"params": {
"referenceId": "PUMP_TRADES",
"streams": [{
"stream": "pumpFunTradesSubscribe",
"params": {}
}]
}
}
await self.websocket.send(json.dumps(subscription))
async def listen(self):
async for message in self.websocket:
data = json.loads(message)
if data.get('method') == 'pumpFunTradesSubscribe':
await self.process_trade(data['result'])
async def process_trade(self, trade):
trade_type = "BUY" if trade['isBuy'] else "SELL"
sol_amount = trade['amountInSol'] / 1e9 # Convert lamports to SOL
print(f"\n[{trade_type}] Trade Detected")
print(f" Token: {trade['token'][:8]}...")
print(f" Wallet: {trade['wallet'][:8]}...")
print(f" SOL Amount: {sol_amount:.4f}")
print(f" Token Amount: {trade['amountInToken']:,}")
print(f" Price: {trade['priceInSol']} SOL")
print(f" Fee: {trade['fee'] / 1e9:.6f} SOL")
print(f" Block: {trade['blockNum']}")
async def main():
monitor = PumpFunTradeMonitor("YOUR_API_KEY")
await monitor.connect()
await monitor.subscribe() # Subscribe to all tokens
await monitor.listen()
if __name__ == "__main__":
asyncio.run(main())
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Best Practices ​
1. Connection Management ​
- Implement Reconnection Logic: Set up exponential backoff reconnection with proper error handling
- Use Heartbeat Monitoring: Send periodic pings to maintain connection health and detect failures
- Handle Subscription Confirmations: Store subscription IDs for proper cleanup and management
2. Data Processing & Analysis ​
- Convert Units Properly: Always divide
amountInSol
by 1e9 to get readable SOL amounts - Track Volume Metrics: Monitor unusual trading patterns and set alerts for large trades (>10 SOL)
- Store Historical Data: Keep trade history for pattern analysis and trend identification
3. Risk Management ​
- Monitor Whale Activity: Set up alerts for large trades and track known whale wallet addresses
- Fee Analysis: Track
feeBasisPoints
andcreatorFee
to understand trading costs and token economics - Filter Strategically: Use token/wallet filters to focus on relevant trades and reduce data overhead