SolanaStreaming Docs

Stonk.fun API

New pools, migrations, and price changes

The SolanaStreaming WebSocket API identifies Stonk.fun as a Raydium LaunchLab sub-exchange. Use subExchange: ["stonkfun"] for its new pools and swaps. LaunchLab tokens that migrate are reported as new pools with pair.migration set to raydium_launchlab. See example code snippets for different use cases below.

Install ws with npm install ws and set YOUR_API_KEY_HERE. Each example below opens its own authenticated connection.

Subscribe to new Stonk.fun pools

const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
  headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
  ws.send(JSON.stringify({
    method: "newPairSubscribe",
    params: { include: { subExchange: ["stonkfun"] } }
  }));
  console.log("Listening for new Stonk.fun pools...");
});
ws.on("message", raw => {
  const message = JSON.parse(raw.toString());
  if (message.error) return console.error("API error:", message.error);
  if (message.params)
    console.log("New Stonk.fun pool:", message.params);
});
ws.on("error", console.error);

Subscribe to LaunchLab migrations

const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
  headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
  ws.send(JSON.stringify({
    method: "newPairSubscribe",
    params: { include: { migration: ["raydium_launchlab"] } }
  }));
  console.log("Listening for LaunchLab migrations...");
});
ws.on("message", raw => {
  const message = JSON.parse(raw.toString());
  if (message.error) return console.error("API error:", message.error);
  if (message.params)
    console.log("LaunchLab migration:", message.params);
});
ws.on("error", console.error);

Subscribe to a single Stonk.fun token for price changes by mint address

const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
  headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
  ws.send(JSON.stringify({
    method: "swapSubscribe",
    params: { include: { baseTokenMint: ["TOKEN_MINT_HERE"] } }
  }));
  console.log("Listening for Stonk.fun token price changes...");
});
ws.on("message", raw => {
  const message = JSON.parse(raw.toString());
  if (message.error) return console.error("API error:", message.error);
  if (message.params)
    console.log("Stonk.fun token price change:", message.params);
});
ws.on("error", console.error);

Subscribe to a single Stonk.fun token for price changes by pool address

const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
  headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
  ws.send(JSON.stringify({
    method: "swapSubscribe",
    params: { include: { ammAccount: ["POOL_ADDRESS_HERE"] } }
  }));
  console.log("Listening for Stonk.fun pool price changes...");
});
ws.on("message", raw => {
  const message = JSON.parse(raw.toString());
  if (message.error) return console.error("API error:", message.error);
  if (message.params)
    console.log("Stonk.fun pool price change:", message.params);
});
ws.on("error", console.error);

Subscribe to all Stonk.fun pool price changes

const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
  headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
  ws.send(JSON.stringify({
    method: "swapSubscribe",
    params: { include: { subExchange: ["stonkfun"] } }
  }));
  console.log("Listening for Stonk.fun price changes...");
});
ws.on("message", raw => {
  const message = JSON.parse(raw.toString());
  if (message.error) return console.error("API error:", message.error);
  if (message.params)
    console.log("Stonk.fun price change:", message.params);
});
ws.on("error", console.error);

The pair filter uses OR matching; the client checks pair.subExchange and pair.migration to tell Stonk.fun launches apart from migration pools. For price updates, inspect swap.quotePrice, swap.usdValue, and swap.swapType. QuotePrice is denoted in the quote token of the swap. To get the usdPrice you must convert the quoteToken to USD.

See the new-pair reference and swap reference.

Stonk.fun WebSocket API FAQ

How do I subscribe only to Stonk.fun LaunchLab events?

For new pools, send newPairSubscribe with params.include.subExchange: ["stonkfun"]. For swaps, use the same subExchange value in a swapSubscribe request.

How can I identify a migrated LaunchLab token?

Subscribe to new pairs with migration: ["raydium_launchlab"], then inspect pair.migration and pair.sourceExchange to distinguish migrations from Stonk.fun launches.