subscribe_sol_price - live SOL/USD
A single global feed of the current SOL/USD price, derived from the deepest on-chain SOL/USDC market. The server emits sol_price whenever the rate moves. This is the same rate used to fill priceUSD / mcapUSD on subscribe, exposed on its own so you can convert WSOL-quoted values yourself.
Takes no arguments. Free - never metered.
| Channel | Socket.IO event |
| Auth | auth.api_key in the handshake |
| Emits | sol_price |
Example
- JavaScript
- Python
import { io } from "socket.io-client";
const socket = io("https://api.pumpdata.fun", {
auth: { api_key: "pd_xxxxxxxx…" },
});
socket.on("sol_price", ({ price }) => {
console.log(`SOL is $${price}`);
});
socket.emit("subscribe_sol_price", (ack) => {
// ack.snapshot is the current value (or null if not known yet)
console.log("subscribed:", ack);
});
// later, to stop: socket.emit("unsubscribe_sol_price");
import socketio
sio = socketio.Client()
@sio.on("sol_price")
def on_price(p):
print("SOL is $", p["price"])
sio.connect("https://api.pumpdata.fun", auth={"api_key": "pd_xxxxxxxx…"})
sio.emit("subscribe_sol_price", callback=lambda ack: print("subscribed:", ack))
sio.wait()
Response - sol_price
{
"price": 182.45,
"time": 1779812600
}
price is USD per SOL; time is the unix second of the update. On subscribe, the current snapshot is sent immediately (and also returned as ack.snapshot) so you have a value without waiting for the next move.
Try it
Notes
- One global value - there is no
mint/poolargument. - Free: subscribing and every
sol_priceevent are never billed. - Use it to convert any WSOL-quoted
priceto dollars yourself, or just readpriceUSD/mcapUSDstraight offsubscribe.