WebSocket Twitter Alerts for Trading Bots

Stream enriched Twitter alerts directly to your trading systems with sub-second latency

Real-Time Alerts for Automated Trading

Connect your trading bot directly to TweetStream's WebSocket stream and receive Twitter alerts in approximately 300ms. Every alert arrives enriched with detected tokens, live prices, and extracted text from images - no additional processing required.

Why WebSocket?

  • Persistent connection - No polling overhead, alerts push instantly when tweets are detected
  • Sub-second latency - ~300ms average delivery time from tweet to your bot
  • Structured data - JSON envelopes with consistent schema for easy parsing
  • Connection management - Built-in heartbeat and reconnection support

Enriched Alert Data

Every tweet alert includes:

  • Detected tokens with contract addresses and live prices
  • OCR-extracted text from screenshots and images
  • Polymarket and Kalshi market references with live odds
  • CEX ticker matches (Binance, Bybit, Hyperliquid)
  • Full tweet content including media and referenced tweets

Quick Start

Connect to TweetStream in just a few lines of code:

const API_KEY = 'YOUR_API_KEY';
const WS_URL = 'wss://ws.tweetstream.io/ws';

const protocols = [
  'tweetstream.v1',
  `tweetstream.auth.token.${API_KEY}`,
];

const ws = new WebSocket(WS_URL, protocols);

ws.onmessage = (event) => {
  const envelope = JSON.parse(event.data);

  if (envelope.t === 'tweet' && envelope.op === 'content') {
    const tweet = envelope.d;
    const author = tweet.author?.handle ?? 'unknown';
    
    // Access detected tokens with live prices
    const meta = envelope.d.meta;
    if (meta?.detected?.tokens?.length) {
      for (const token of meta.detected.tokens) {
        console.log(`Token: ${token.symbol} @ $${token.priceUsd}`);
        // Trigger your trading logic here
      }
    }
  }
};

Use Cases

Trading bots that react to influencer tweets, portfolio trackers that monitor whale accounts, research tools that analyze sentiment in real-time, and notification systems that alert teams to market-moving announcements.

Frequently Asked Questions

Ready to get started?

Try TweetStream free for 1 day. No commitment required.

Start 1-Day Trial

Related Pages