Trading & Quantitative Infrastructure Production Active Live Streaming

Real-Time Stock Surveillance & Low-Latency Alerting Infrastructure

A high-throughput market surveillance engine featuring asynchronous multi-ticker price streams, headless Selenium order-book scrapers, and sub-250ms WebSocket alert triggers dispatched to Telegram, Discord, and front-end dashboards.

Streaming Latency
< 250ms
Sub-second updates
Tracked Tickers
100+
Equities & Crypto
System Uptime
99.95%
Continuous 24/7
Alert Dispatch
Instant
WebSockets & Hooks

The Problem

Active traders and fund analysts miss high-conviction breakout opportunities due to delayed delayed polling, delayed push notifications from retail brokers, and prohibitive terminal subscription costs.

The Solution

Built an autonomous surveillance daemon using Python, Selenium headless pools, Redis caching, and WebSockets. Users define custom mathematical thresholds and receive sub-250ms push notifications with full candle snapshots.

Architecture & Event Dispatch Flow

1

Tick Ingestion & Worker Pooling

Asynchronous worker threads polling multi-exchange financial endpoints and headless Selenium scrapers without triggering rate limit throttles.

2

In-Memory Redis State & Threshold Evaluation

Sub-millisecond condition verification checking price levels, Volume Weighted Average Price (VWAP), and RSI overbought/oversold levels with anti-jitter debouncing.

3

Sub-Second WebSocket Broadcasting

Real-time WebSocket server streaming candlestick updates to connected web dashboards and triggering asynchronous webhooks to Discord and Telegram bots.

WebSocket Price Alert Dispatcher

# Low-Latency Asynchronous Alert & Webhook Dispatcher
import asyncio
from typing import Dict, List, Callable

class MarketSentinel:
    def __init__(self):
        self.watchlist: Dict[str, float] = {}
        self.alert_rules: List[Dict] = []

    def set_price_alert(self, symbol: str, threshold: float, direction: str, notify_fn: Callable):
        self.alert_rules.append({
            "symbol": symbol,
            "threshold": threshold,
            "direction": direction,
            "notify_fn": notify_fn,
            "triggered": False
        })

    async def ingest_tick(self, symbol: str, current_price: float):
        self.watchlist[symbol] = current_price
        for rule in self.alert_rules:
            if rule["symbol"] == symbol and not rule["triggered"]:
                if (rule["direction"] == "CROSS_ABOVE" and current_price >= rule["threshold"]) or \
                   (rule["direction"] == "CROSS_BELOW" and current_price <= rule["threshold"]):
                    rule["triggered"] = True
                    await rule["notify_fn"]({
                        "symbol": symbol,
                        "price": current_price,
                        "target": rule["threshold"],
                        "direction": rule["direction"]
                    })
🇵🇰 Karachi, Pakistan
"Majid engineered our price streaming and WebSocket alert hub. The sub-second speed, low-latency Redis caching, and bulletproof reliability made a massive difference to our real-time tracking architecture."
Hamza Siddiqui
Hamza Siddiqui
CTO • FleetLogix Pakistan (Karachi)
Prev: AI Data Platform Next: Backtesting Engine