Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt

Use this file to discover all available pages before exploring further.

The Datastream WebSocket gives you real-time price feeds for any Solana token. Connect once and receive price updates as they happen — no polling required.
URL: wss://datastream.solanatracker.io/{apiKey}
Available on Premium, Business, and Enterprise plans.

Connect

All Datastream channels use the same WebSocket connection. Send JSON messages to join and leave rooms.
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

ws.onopen = () => {
  console.log("Connected");
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "message") {
    // Handle data
  }
};

Price by Token

Subscribe to price-by-token:{tokenAddress} to get price updates from the primary pool. The primary pool is usually the pool with the most liquidity, meaning the most funds available for trading.
const token = "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump";

// Join
ws.send(JSON.stringify({ type: "join", room: `price-by-token:${token}` }));

// Receive
ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "joined") {
    console.log(`Subscribed to ${msg.room}`);
  }
  if (msg.type === "message") {
    const { price, price_quote, pool, time } = msg.data;
    console.log(`$${price} (${price_quote} SOL) at ${new Date(time).toISOString()}`);
  }
};

// Leave when done
ws.send(JSON.stringify({ type: "leave", room: `price-by-token:${token}` }));
Payload:
{
  "type": "message",
  "room": "price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
  "data": {
    "price": 0.008006,
    "price_quote": 0.00010064,
    "pool": "EWiYmq3nWQpoTkcU4UfGYEoYvDHduDsXhpPvqmoqpump",
    "token": "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
    "time": 1723728065246
  }
}

Aggregated Price

Subscribe to price:aggregated:{tokenAddress} for one price made from many pools. The message includes median, average, min, max, and pool count. Use this for high-liquidity tokens that trade across multiple pools.
const sol = "So11111111111111111111111111111111111111112";

ws.send(JSON.stringify({ type: "join", room: `price:aggregated:${sol}` }));

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "message") {
    const { price, aggregated } = msg.data;
    console.log(`Price: $${price}`);
    console.log(`Median: $${aggregated.median} (${aggregated.poolCount} pools)`);
    console.log(`Range: $${aggregated.min} — $${aggregated.max}`);
  }
};
Payload:
{
  "price": 153.70,
  "aggregated": {
    "median": 153.68,
    "average": 153.67,
    "min": 153.36,
    "max": 153.71,
    "poolCount": 10
  },
  "topPools": [...]
}

Price by Pool

Subscribe to price:{poolId} for price updates from one specific pool. Use this when you care about a particular DEX or liquidity source.
ws.send(JSON.stringify({ type: "join", room: "price:EWiYmq3nWQpoTkcU4UfGYEoYvDHduDsXhpPvqmoqpump" }));

All Pool Prices

Subscribe to price:{tokenAddress} (without aggregated) to receive individual price updates from every pool a token trades on.
ws.send(JSON.stringify({ type: "join", room: `price:${token}` }));

Token Changes (Full Updates)

Subscribe to token:{tokenAddress} for comprehensive pool updates — price, liquidity, market cap, supply, and security data all in one message.
ws.send(JSON.stringify({ type: "join", room: `token:${token}` }));

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "message") {
    const d = msg.data;
    console.log(`Price: $${d.price.usd}`);
    console.log(`Liquidity: $${d.liquidity.usd}`);
    console.log(`Market Cap: $${d.marketCap.usd}`);
    console.log(`LP Burn: ${d.lpBurn}%`);
  }
};
For primary pool only (less noise on multi-pool tokens):
ws.send(JSON.stringify({ type: "join", room: `token:${token}:primary` }));

Live Transactions

Subscribe to transaction:{tokenAddress} to see every swap as it happens.
ws.send(JSON.stringify({ type: "join", room: `transaction:${token}` }));

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "message") {
    const trades = Array.isArray(msg.data) ? msg.data : [msg.data];
    trades.forEach(t => {
      const side = t.type === "buy" ? "BUY " : "SELL";
      console.log(`${side} $${t.volume.toFixed(2)} by ${t.wallet}`);
    });
  }
};
Filter by pool:
ws.send(JSON.stringify({
  type: "join",
  room: `transaction:${token}:${poolId}`
}));

Build a Live Chart

Combine the price stream with the OHLCV REST endpoint to build a real-time chart. OHLCV means open, high, low, close, and volume. Use REST for historical candles, then update the latest candle with WebSocket ticks.
const token = "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump";
const headers = { "x-api-key": "YOUR_API_KEY" };

// 1. Load historical candles via REST
const now = Math.floor(Date.now() / 1000);
const candles = await fetch(
  `https://data.solanatracker.io/chart/${token}?type=1m&time_from=${now - 3600}&time_to=${now}`,
  { headers }
).then(r => r.json());

let currentCandle = candles[candles.length - 1];

// 2. Stream live price updates
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({ type: "join", room: `price-by-token:${token}` }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type !== "message") return;

  const { price, time } = msg.data;
  const candleStart = Math.floor(time / 60000) * 60;

  if (candleStart > currentCandle.time) {
    // New candle
    candles.push(currentCandle);
    currentCandle = { time: candleStart, open: price, high: price, low: price, close: price, volume: 0 };
  } else {
    // Update current candle
    currentCandle.close = price;
    currentCandle.high = Math.max(currentCandle.high, price);
    currentCandle.low = Math.min(currentCandle.low, price);
  }

  // Render candles + currentCandle to your chart library
};

Open-Source Chart Examples

We have two open-source chart implementations you can use as a starting point:

Liveline Chart

Minimal real-time line chart using the Datastream WebSocket. Good starting point for custom UIs.

TradingView Advanced Chart

Full TradingView Advanced Charts integration with real-time candle updates from the Datastream.

Volume & Statistics

Token Volume

Subscribe to volume:token:{tokenAddress} for aggregated volume updates:
ws.send(JSON.stringify({ type: "join", room: `volume:token:${token}` }));

Token Statistics

Subscribe to stats:token:{tokenAddress} for multi-timeframe stats (1m, 5m, 1h, 6h, 24h buy/sell counts, volume, unique traders):
ws.send(JSON.stringify({ type: "join", room: `stats:token:${token}` }));
For a single total snapshot:
ws.send(JSON.stringify({ type: "join", room: `stats:token:${token}:total` }));

Room Reference

Room patternWhat you get
price-by-token:{token}Price from primary pool
price:aggregated:{token}Cross-pool median/avg/min/max
price:{pool}Price from one pool
price:{token}Price from all pools
token:{token}Full pool state (price, liquidity, mcap)
token:{token}:primaryPrimary pool state only
transaction:{token}All swaps on a token
transaction:{token}:{pool}Swaps in a specific pool
volume:token:{token}Aggregated volume
stats:token:{token}Multi-timeframe statistics

Price & Charts (REST)

REST endpoints for historical OHLCV, price snapshots, and ATH data.

Token Discovery Streams

Stream new tokens, graduating tokens, and market events.