subscribe_trades - live trades
Every trade executed on the pool, with full details (wallet, signature, amounts, price). Server emits trade. Pass one of mint or pool.
| Channel | Socket.IO event |
| Auth | auth.api_key in the handshake |
| Emits | trade |
Example
- JavaScript
- Python
import { io } from "socket.io-client";
const socket = io("https://api.pumpdata.fun", {
auth: { api_key: "pd_xxxxxxxx…" },
});
socket.on("trade", (t) => {
const side = t.is_buy ? "BUY " : "SELL";
console.log(`${side} ${t.token_amount.toFixed(2)} @ ${t.price} by ${t.wallet.slice(0, 4)}…`);
});
socket.emit("subscribe_trades", { pool: "4mBL…" });
// later, to stop (free): socket.emit("unsubscribe_trades", { pool: "4mBL…" });
import socketio
sio = socketio.Client()
@sio.on("trade")
def on_trade(t):
side = "BUY " if t["is_buy"] else "SELL"
print(f"{side} {t['token_amount']:.2f} @ {t['price']} by {t['wallet'][:4]}…")
sio.connect("https://api.pumpdata.fun", auth={"api_key": "pd_xxxxxxxx…"})
sio.emit("subscribe_trades", {"pool": "4mBL…"})
sio.wait()
# later, to stop (free): sio.emit("unsubscribe_trades", {"pool": "4mBL…"})
Response - trade
{
"protocol": "PUMPSWAP",
"pool": "4mBLRPUyfE7CvxmXiGJx5WA51isanbxpdbdPjFuuBzmY",
"mint": "Gc6rNxGnoQt6vCfhNzn5iJnPBu1V38GZfdYERfnXpump",
"signature": "c9asMSPXxiEYC4RQpLBFUAASCL63TXZpPgSPgivDcJxsNoNc7ptrh6DfJy67NS2p7nEQBbVR45ZuPhyBqectR76",
"is_buy": true,
"token_amount": 153285714.285714,
"quote_amount": 5.0,
"price": 0.000000033,
"marketcap": 32.618826,
"wallet": "9AiXyDfy6cKieVPgwyfsNS37HypoS8k7ju2CV3WnyvZG",
"timestamp": 1779812627
}
is_buy-trueif the trader received the base token (price went up);falseif they sold it.token_amount/quote_amount- in human units (already adjusted for decimals).
Errors
If the subscription cannot be created, the ack callback receives an error object instead of { ok: true }:
{ "error": "not_found", "message": "pool not found" }
error | When |
|---|---|
invalid_request | Neither mint nor pool was provided. |
not_found | The mint has no active pool, or the given pool is not known to the data plane. |
unavailable | A transient backend error (the server already retried). Safe to retry - it is not a definitive "not found". |
If you do not pass an ack callback, the same payload is emitted as a subscription_error event instead.