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

# Monitorizar señales de riesgo Solana por WebSocket

> Recibe cambios de snipers, bundlers, insiders, posiciones del desarrollador y concentración de holders.

Suscríbete a las señales que muestra tu aplicación. Usa la API de riesgo del token para el snapshot inicial y Datastream para seguir los cambios.

<Info>
  **URL:** `wss://datastream.solanatracker.io/{apiKey}`\
  Disponible en los planes Premium, Business y Enterprise.
</Info>

## Seguimiento de snipers

Suscríbete a `sniper:{tokenAddress}` para recibir una notificación cuando el saldo de una wallet sniper cambie — compras, ventas o salidas parciales.

```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
}
```

## Seguimiento de bundlers

Suscríbete a `bundlers:{tokenAddress}` para seguir cambios en wallets asociadas a transacciones agrupadas.

```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>
  `totalBundlerPercentage` mide la oferta en wallets asociadas a transacciones agrupadas. El umbral de alerta depende de tu aplicación.
</Warning>

## Seguimiento de insiders

Suscríbete a `insider:{tokenAddress}` para seguir wallets identificadas por las señales de insiders de la API.

```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}%`);
};
```

## Holdings del developer

Suscríbete a `dev_holding:{tokenAddress}` para seguir cambios en las posiciones del developer.

```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
}
```

## Cambios de holders

### Número de holders

Suscríbete a `holders:{tokenAddress}` para actualizaciones en tiempo real del número de holders:

```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

Suscríbete a `top10:{tokenAddress}` para seguir la concentración entre las 10 wallets principales:

```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}%`);
  });
};
```

## Monitorización de wallets

### Transacciones del wallet

Suscríbete a `wallet:{walletAddress}` para ver cada swap que realiza un wallet en tiempo real:

```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)}`);
};
```

### Cambios de saldo del wallet

Suscríbete a `wallet:{walletAddress}:balance` para cambios globales de saldo:

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

### Saldo de un token específico

Suscríbete a `wallet:{walletAddress}:{tokenAddress}:balance` para vigilar el saldo de un único token:

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

## Seguimiento de fees

Suscríbete a `fees:{tokenAddress}` para rastrear las fees de plataforma y red en un token:

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

## Ejemplo: monitor de seguridad de tokens

Combina varios streams de seguridad para construir un dashboard de riesgo en tiempo real:

```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]}`);
  }
};
```

## Referencia de salas

| Sala | Lo que obtienes |
| - | - |
| `sniper:{token}` | Cambios de saldo de wallets sniper |
| `bundlers:{token}` | Actividad de wallets bundler |
| `insider:{token}` | Movimientos de wallets insider |
| `dev_holding:{token}` | Holdings del developer/creador |
| `holders:{token}` | Número total de holders |
| `top10:{token}` | Porcentajes del top 10 de holders |
| `wallet:{wallet}` | Todos los swaps de una wallet |
| `wallet:{wallet}:balance` | Cambios de saldo del wallet |
| `wallet:{wallet}:{token}:balance` | Saldo específico de un token |
| `fees:{token}` | Seguimiento de fees |

<CardGroup cols={2}>
  <Card title="Compradores y bundlers" href="/es/guides/sniper-detection">
    Endpoints REST para primeros compradores, bundlers y detección basada en gráficos.
  </Card>

  <Card title="Precios en vivo" href="/es/guides/datastream-prices">
    Transmite precios en tiempo real y crea gráficos en vivo.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.