030-realtime-data

030-realtime-data is a cursor rule for Cursor from juandoroteoflesiauni-lang/Market-options-stocks-Scanner. It costs 0 tokens per session (2,203 once invoked), scanned A, original, Apache-2.0.

Rules for receiving live market data through WebSockets, a connection that lets the server send updates without repeated requests. They describe how one exchange stream can be shared with many connected clients.

In plain words
What is it for?
Use it when implementing market feeds, client subscriptions, connection management and real-time updates for trading symbols.
Why use it?
They help keep rapidly changing market information organised and reduce errors caused by unmanaged connections or subscriptions.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when implementing market feeds, client subscriptions, connection management and real-time updates for trading symbols.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/030-realtime-data
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/juandoroteoflesiauni-lang/Market-options-stocks-Scanner

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 030-realtime-data

README.md
[![agentmods](https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/030-realtime-data/github.svg)](https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/030-realtime-data)
Your own site
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/030-realtime-data"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/030-realtime-data/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 030-realtime-data

Your own site · 80×15
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/030-realtime-data"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/030-realtime-data.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,203 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.02203
Opus 5 $0.00000 $0.01102
Sonnet 5 $0.00000 $0.00441
Haiku 4.5 $0.00000 $0.00220

Measured 12d ago against content hash 537893ccac15, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

030-realtime-data scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/030-realtime-data.mdc · 325 lines

How it starts

The opening of the file, as written. The whole thing — 325 lines — stays where its author put it; the contents beside it link to each section on GitHub.

⚡ DATOS EN TIEMPO REAL — TRADING TERMINAL

PRINCIPIOS DE TRADING EN TIEMPO REAL

Los datos de mercado llegan miles de veces por segundo. Un error en este módulo = datos incorrectos = decisiones de trading equivocadas = pérdidas.


🔌 ARQUITECTURA WEBSOCKET BACKEND

# backend/app/websockets/market_feed.py

from fastapi import WebSocket, WebSocketDisconnect
from typing import Dict, Set
import asyncio
import json

class MarketFeedManager:
    """
    Gestiona todas las conexiones WebSocket de clientes.
    Patrón: PubSub — un stream de exchange, N clientes.
    """

    def __init__(self):
        # symbol -> set de websockets conectados
        self._subscribers: Dict[str, Set[WebSocket]] = {}
        self._lock = asyncio.Lock()

    async def subscribe(self, websocket: WebSocket, symbol: str) -> None:
        """Suscribir cliente a un símbolo."""
        async with self._lock:
            if symbol not in self._subscribers:
                self._subscribers[symbol] = set()
                # Iniciar feed del exchange si es el primero
                asyncio.create_task(self._start_exchange_feed(symbol))
            self._subscribers[symbol].add(websocket)

    async def unsubscribe(self, websocket: WebSocket, symbol: str) -> None:
        """Desuscribir cliente — SIEMPRE llamar en disconnect."""
        async with self._lock:
            if symbol in self._subscribers:
                self._subscribers[symbol].discard(websocket)
                if not self._subscribers[symbol]:
                    # Limpiar stream si no hay más clientes
                    del self._subscribers[symbol]

    async def broadcast(self, symbol: str, data: dict) -> None:
        """Enviar datos a todos los clientes suscritos."""
        if symbol not in self._subscribers:
            return

        dead_connections = set()
        message = json.dumps(data)

        for websocket in self._subscribers[symbol].copy():
            try:
                await websocket.send_text(message)
            except Exception:
                dead_connections.add(websocket)

        # Limpiar conexiones muertas
        for ws in dead_connections:
            await self.unsubscribe(ws, symbol)

    async def _start_exchange_feed(self, symbol: str) -> None:
        """Conectar al exchange y retransmitir datos."""
        try:
            async for tick in exchange.get_price_stream(symbol):
                if symbol not in self._subscribers:
                    break  # No hay más suscriptores
                await self.broadcast(symbol, {
                    "type": "tick",
                    "symbol": symbol,
                    "price": str(tick.price),
                    "volume": str(tick.volume),
                    "timestamp": tick.timestamp.isoformat()
                })
        except Exception as e:
            logger.error(f"Exchange feed error for {symbol}: {e}")

feed_manager = MarketFeedManager()

# Endpoint WebSocket
@router.websocket("/ws/market/{symbol}")
async def market_websocket(websocket: WebSocket, symbol: str):
    await websocket.accept()
    await feed_manager.subscribe(websocket, symbol)
    try:
        while True:
            # Mantener conexión viva con heartbeat
            await websocket.receive_text()
    except WebSocketDisconnect:
        await feed_manager.unsubscribe(websocket, symbol)

Read the full file on GitHub · 325 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 325 lines · 0 tokens per session scan A 537893ccac15

Subscribe to this mod's changes

030-realtime-data is a cursor rule published in the GitHub repository juandoroteoflesiauni-lang/Market-options-stocks-Scanner (11 stars, last pushed 2mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,203 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.