> ## 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.

# Safety Streams

> Stream live token safety signals — sniper buys, bundled launches, insider trades, developer holdings, and holder count changes — over WebSocket.

The Datastream WebSocket provides real-time safety signals. Use it to watch sniper activity, bundled transactions, insider movements, developer sell-offs, and holder concentration changes as they happen.

<Info>
  **URL:** `wss://datastream.solanatracker.io/{apiKey}`\
  Available on Premium, Business, and Enterprise plans.
</Info>

## Sniper Tracking

Subscribe to `sniper:{tokenAddress}` to get notified when a sniper wallet's balance changes — buys, sells, or partial exits.

```javascript theme={null}
const token = "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN";
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

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

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

  const d = msg.data;
  const direction = d.percentage > d.previousPercentage ? "INCREASED" : "DECREASED";
  console.log(`Sniper ${d.wallet} ${direction}`);
  console.log(`  Balance: ${d.tokenAmount} (${d.percentage}%)`);
  console.log(`  Previous: ${d.previousAmount} (${d.previousPercentage}%)`);
  console.log(`  Total sniper hold: ${d.totalSniperPercentage}%`);
  console.log(`  Total insider hold: ${d.totalInsiderPercentage}%`);
};
```

**Payload:**

```json theme={null}
{
  "wallet": "WalletAddress",
  "amount": "1000000000",
  "tokenAmount": 1000000,
  "percentage": 0.15,
  "previousAmount": 500000,
  "previousPercentage": 0.075,
  "totalSniperPercentage": 5.25,
  "totalInsiderPercentage": 12.5
}
```

***

## Bundler Tracking

Subscribe to `bundlers:{tokenAddress}` to track wallets involved in bundled transactions. This often means wallets moved together on purpose.

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `bundlers:${token}` }));

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

  const d = msg.data;
  const action = d.tokenAmount > d.previousAmount ? "BOUGHT" : "SOLD";
  console.log(`Bundler ${d.wallet} ${action}`);
  console.log(`  Holdings: ${d.tokenAmount} (${d.percentage}%)`);
  console.log(`  Total bundler hold: ${d.totalBundlerPercentage}%`);
};
```

**Payload:**

```json theme={null}
{
  "wallet": "4ZwYf8okEL7vgyBDZEcas2mcpDAVujsgtthxRHCMDqyP",
  "amount": "7965607901843",
  "tokenAmount": 7965607.901843,
  "percentage": 0.79656,
  "previousAmount": 8997866.309773,
  "previousPercentage": 0.89979,
  "boughtAmount": 0,
  "boughtPercentage": 0,
  "totalBundlerPercentage": 22.83809
}
```

<Warning>
  A `totalBundlerPercentage` above 20% is a strong red flag — it means a large portion of the supply is held by bundled wallets.
</Warning>

***

## Insider Tracking

Subscribe to `insider:{tokenAddress}` to watch insider wallet movements. Insiders are wallets identified as having privileged access to the token, such as deployer-connected wallets or early coordinated buyers.

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `insider:${token}` }));

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

  const d = msg.data;
  console.log(`Insider ${d.wallet}: ${d.percentage}% (was ${d.previousPercentage}%)`);
  console.log(`  Total insider hold: ${d.totalInsiderPercentage}%`);
};
```

***

## Developer Holdings

Subscribe to `dev_holding:{tokenAddress}` to track the token creator's holdings in real time. A creator selling a large share can be one of the strongest risk signals.

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `dev_holding:${token}` }));

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

  const d = msg.data;
  const change = d.percentage - d.previousPercentage;
  const emoji = change < 0 ? "SOLD" : "ADDED";
  console.log(`Dev ${d.creator} ${emoji}: ${d.percentage}% (was ${d.previousPercentage}%)`);
};
```

**Payload:**

```json theme={null}
{
  "token": "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
  "creator": "4Rz5xqikxtZ2s7wE9uQ6n2oLXQi6K65XGoYpKxf24Hqo",
  "amount": "150000000000",
  "percentage": 15.0,
  "previousPercentage": 20.0,
  "timestamp": 1739318753652
}
```

***

## Holder Changes

### Holder Count

Subscribe to `holders:{tokenAddress}` for real-time holder count updates:

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `holders:${token}` }));

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "message") {
    console.log(`Holders: ${msg.data.total}`);
  }
};
```

### Top 10 Holders

Subscribe to `top10:{tokenAddress}` to track concentration among the top 10 wallets:

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `top10:${token}` }));

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

  const totalPct = msg.data.holders.reduce((sum, h) => sum + h.percentage, 0);
  console.log(`Top 10 hold ${totalPct.toFixed(1)}% of supply`);
  msg.data.holders.forEach((h, i) => {
    console.log(`  #${i + 1} ${h.address}: ${h.percentage}%`);
  });
};
```

***

## Wallet Monitoring

### Wallet Transactions

Subscribe to `wallet:{walletAddress}` to see every swap a wallet makes in real time:

```javascript theme={null}
const wallet = "FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1";

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

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

  const t = msg.data;
  const fromToken = t.from?.token?.symbol;
  const toToken = t.to?.token?.symbol;
  console.log(`${fromToken} → ${toToken}: $${t.volume?.usd?.toFixed(2)}`);
};
```

### Wallet Balance Changes

Subscribe to `wallet:{walletAddress}:balance` for overall balance changes:

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `wallet:${wallet}:balance` }));
```

### Specific Token Balance

Subscribe to `wallet:{walletAddress}:{tokenAddress}:balance` to watch a single token balance:

```javascript theme={null}
ws.send(JSON.stringify({
  type: "join",
  room: `wallet:${wallet}:${token}:balance`
}));
```

***

## Fee Tracking

Subscribe to `fees:{tokenAddress}` to track platform and network fees on a token:

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `fees:${token}` }));
```

***

## Example: Token Safety Monitor

Combine multiple safety streams to build a real-time risk dashboard:

```javascript theme={null}
const token = "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN";
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

const alerts = [];

ws.onopen = () => {
  // Subscribe to all safety signals
  ws.send(JSON.stringify({ type: "join", room: `sniper:${token}` }));
  ws.send(JSON.stringify({ type: "join", room: `bundlers:${token}` }));
  ws.send(JSON.stringify({ type: "join", room: `insider:${token}` }));
  ws.send(JSON.stringify({ type: "join", room: `dev_holding:${token}` }));
  ws.send(JSON.stringify({ type: "join", room: `top10:${token}` }));
  ws.send(JSON.stringify({ type: "join", room: `holders:${token}` }));
};

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

  const room = msg.room;
  const d = msg.data;

  if (room.startsWith("sniper:") && d.percentage < d.previousPercentage) {
    alerts.push(`Sniper selling: ${d.wallet} (${d.previousPercentage}% → ${d.percentage}%)`);
  }

  if (room.startsWith("bundlers:") && d.totalBundlerPercentage > 20) {
    alerts.push(`High bundler concentration: ${d.totalBundlerPercentage}%`);
  }

  if (room.startsWith("dev_holding:") && d.percentage < d.previousPercentage) {
    alerts.push(`Dev selling: ${d.percentage}% (was ${d.previousPercentage}%)`);
  }

  if (room.startsWith("top10:")) {
    const totalPct = d.holders.reduce((sum, h) => sum + h.percentage, 0);
    if (totalPct > 50) {
      alerts.push(`Top 10 hold ${totalPct.toFixed(1)}% — high concentration`);
    }
  }

  if (alerts.length > 0) {
    console.log(`[ALERT] ${alerts[alerts.length - 1]}`);
  }
};
```

***

## Room Reference

| Room                              | What you get                  |
| --------------------------------- | ----------------------------- |
| `sniper:{token}`                  | Sniper wallet balance changes |
| `bundlers:{token}`                | Bundler wallet activity       |
| `insider:{token}`                 | Insider wallet movements      |
| `dev_holding:{token}`             | Developer/creator holdings    |
| `holders:{token}`                 | Total holder count            |
| `top10:{token}`                   | Top 10 holder percentages     |
| `wallet:{wallet}`                 | All swaps for a wallet        |
| `wallet:{wallet}:balance`         | Wallet balance changes        |
| `wallet:{wallet}:{token}:balance` | Specific token balance        |
| `fees:{token}`                    | Fee tracking                  |

<CardGroup cols={2}>
  <Card title="Sniper Detection (REST)" href="/guides/sniper-detection">
    REST endpoints for first buyers, bundlers, and chart-based detection.
  </Card>

  <Card title="Live Prices & Charts" href="/guides/datastream-prices">
    Stream real-time prices and build live charts.
  </Card>
</CardGroup>
