yourdaylight/stock_datasource · Archived

stock-rt-subscribe

Subscribe to real-time stock market data via WebSocket long connection from receiver nodes (A-shares, HK stocks, ETFs).

First seen Mar 9, 2026

Installation

$ npx skills add yourdaylight/stock_datasource --skill stock-rt-subscribe

Summary

  • Subscribe to real-time stock market data via WebSocket long connection from receiver nodes (A-shares, HK stocks, ETFs).
  • Use this skill when the user wants to monitor live stock prices, set up real-time alerts, or stream minute-level K-line data.
  • The skill provides a WebSocket server that connects to receiver nodes and pushes real-time price updates to all connected clients.

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from yourdaylight/stock_datasource.

npx skills add yourdaylight/stock_datasource

Browse all from yourdaylight/stock_datasource

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 173
License LICENSE
Default branch main
Open issues 2
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,720 B
  • docs SUMMARY.md 402 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 51 installs

SKILL.md

实时股票数据订阅(WebSocket)

通过 WebSocket 长连接 实时接收 A 股、港股、ETF 行情数据,每 3~5 秒更新一次。

架构

Receiver Node (HTTP API) → scripts/subscribe_client.py → ws://localhost:8765 → 客户端

环境准备

pip install requests websockets
export STOCK_RT_NODE_URL="http://your-node:9100"
export STOCK_RT_TOKEN="your-token"   # 可选,有鉴权时设置

快速开始

一次性查询(验证连通性)

python3 scripts/subscribe_client.py --symbols 00700.HK 600519.SH --once

启动 WebSocket 推送服务

# 基础订阅
python3 scripts/subscribe_client.py --symbols 00700.HK 09988.HK 600519.SH

# 指定节点和端口
python3 scripts/subscribe_client.py --node-url http://your-node:9100 --ws-port 8765 --symbols 00700.HK

# 涨跌幅告警(±2% 触发)
python3 scripts/subscribe_client.py --symbols 00700.HK --alert-pct 2.0

# 输出到文件
python3 scripts/subscribe_client.py --symbols 00700.HK --output ticks.jsonl

编程方式启动

from scripts.subscribe_client import StockWSServer

server = StockWSServer(
    node_url="http://your-node:9100",
    symbols=["00700.HK", "09988.HK"],
    poll_interval=3.0,
)
server.add_callback(lambda sym, tick: print(f"{tick.name}: {tick.close}"))
server.run(port=8765)

AI Agent 集成

from scripts.ai_agent_integration import StockDataAgent

agent = StockDataAgent()
agent.install()  # 检查依赖、验证节点连通性

# 完整工作流(订阅 + 告警监控 60 秒)
import asyncio
asyncio.run(agent.complete_workflow(['00700.HK', '600519.SH'], duration=60))

告警策略

告警规则配置见 [references/strategyconfig.json](references/strategyconfig.json),内置策略:

  • limitupdown:涨停/跌停监控
  • big_move:大幅波动(≥ ±5%)
  • vol_spike:成交量异动(≥ 近5日均量3倍)
  • price_breakout:价格突破近20日高点

参考文档

  • [references/api.md](references/api.md):WebSocket 消息格式、数据字段说明、客户端连接示例(Python/JS/wscat)、动态订阅管理指令、排错指南
  • [references/strategyconfig.json](references/strategyconfig.json):告警策略完整配置