
Stock Sector Monitoring
Monitor A-share concept sectors and dragon-tiger board (龙虎榜) listings, filter ST stocks, and save ranked Markdown reports for trading research.
Overview
Stock Sector Monitoring is an agent skill for the Grow phase that runs Tushare-backed sector and dragon-tiger board monitoring and saves filtered Markdown market reports.
Install
npx skills add https://github.com/zuoa/aj-skills --skill stock-sector-monitoringWhat is this skill?
- CLI via scripts/sector-monitoring.py with sector concept boards and LHB (top_list / doc_id=106) data sources
- Filters ST, *ST, S*ST, and SST symbols from results
- Outputs JSON or Markdown with suggested reports/lhb-YYYYMMDD.md and sector-YYYYMMDD.md conventions
- Supports --once runs by trade date, Top N, single ts-code lookup, and threshold warnings
- Tushare-backed pandas pipeline with venv setup documented in README
- Top 20 default-style ranking in documented LHB examples
- Three report filename patterns (lhb, lhb per code, sector)
Adoption & trust: 562 installs on skills.sh; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You watch A-share sectors and LHB flows manually and cannot reproduce dated, ST-filtered rankings in a single agent command.
Who is it for?
Solo builders researching Chinese listed stocks who already have Tushare access and want scripted LHB and concept-sector snapshots.
Skip if: Builders without Tushare credentials, non-CN markets, or teams needing licensed investment advice or live brokerage execution.
When should I use this skill?
You need one-shot or repeatable A-share sector or LHB monitoring with ST filtering and Markdown output for a given trade date.
What do I get? / Deliverables
You get JSON or Markdown reports with Top-N gain and composite lists, threshold cues, and archived filenames for each trade date you query.
- Dated Markdown reports under reports/
- JSON snapshots from --format json runs
- Parameterized sections for gain Top N, composite Top N, and threshold alerts
Recommended Skills
Journey fit
Market monitoring and ranked reports are Grow analytics work—ongoing signal review rather than product shipping or launch distribution. Analytics fits scripted sector/LHB pulls, Top-N rankings, composite scores, and threshold alerts exported as dated reports.
How it compares
A local Python CLI skill with Markdown artifacts—not a hosted market data MCP or a backtesting framework.
Common Questions / FAQ
Who is stock-sector-monitoring for?
Indie developers and agent users doing A-share sector and dragon-tiger board research who want repeatable CLI reports instead of one-off spreadsheet copy-paste.
When should I use stock-sector-monitoring?
During Grow analytics when reviewing daily LHB or concept-sector leaders, comparing trade dates, or alerting on score thresholds before portfolio or content decisions.
Is stock-sector-monitoring safe to install?
The skill runs local Python and needs a Tushare token in your environment; review the Security Audits panel on this page and treat API secrets as sensitive.
SKILL.md
READMESKILL.md - Stock Sector Monitoring
# stock-sector-monitoring A 股市场监测 skill,支持: - 概念板块监测(`sector`) - 龙虎榜(`lhb` / `top_list` / doc_id=106) - 过滤 ST 类股票(`ST`、`*ST`、`S*ST`、`SST`) - 结果输出并保存为 Markdown 报告 ## 安装 Skill(npx skill add) ### 1) 从本地目录安装 ```bash npx skill add /Users/yujian/Code/py/aj-skills/skills/stock-sector-monitoring ``` ### 2) 从 GitHub 安装 ```bash npx skills add https://github.com/zuoa/aj-skills --skill stock-sector-monitoring ``` 安装后重启你的 Agent/Codex 会话以加载新 skill。 ## 环境准备 ```bash cd /Users/yujian/Code/py/aj-skills/skills/stock-sector-monitoring python3 -m venv .venv source .venv/bin/activate python3 -m pip install -U pip python3 -m pip install tushare pandas ``` 配置 token: ```bash export TUSHARE_TOKEN=YOUR_TOKEN ``` ## 快速使用 ### 龙虎榜(推荐) ```bash source .venv/bin/activate python3 scripts/sector-monitoring.py \ --once \ --data-source lhb \ --trade-date 20260213 \ --top 20 \ --format json ``` ### 指定单只股票 ```bash python3 scripts/sector-monitoring.py \ --once \ --data-source lhb \ --trade-date 20260213 \ --ts-code 002219.SZ \ --format json ``` ## Markdown 输出约定 建议将报告落到 `reports/`: - `reports/lhb-YYYYMMDD.md` - `reports/lhb-YYYYMMDD-TS_CODE.md` - `reports/sector-YYYYMMDD.md` 报告建议包含: - 参数区(数据源、日期、TopN、ST 过滤) - 涨幅榜 Top N - 综合评分 Top N - 阈值预警 - 无数据说明(非交易日/无上榜/权限不足) ## 相关文件 - Skill 定义:`SKILL.md` - 主脚本:`scripts/sector-monitoring.py` #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 市场监测 CLI 工具 - Tushare 版本 支持概念板块与龙虎榜数据监测 """ try: import pandas as pd except ModuleNotFoundError: pd = None import time from datetime import datetime import os import sys import argparse from typing import Optional def parse_arguments(): """解析命令行参数""" parser = argparse.ArgumentParser( description='市场实时监测工具 - 基于 Tushare 数据接口', formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" 示例用法: # 单次查询,显示 Top 10 %(prog)s --once --token YOUR_TOKEN # 查询龙虎榜(Tushare doc_id=106) %(prog)s --once --data-source lhb --trade-date 20260213 # 查询某只股票当日龙虎榜 %(prog)s --once --data-source lhb --trade-date 20260213 --ts-code 002219.SZ # 持续监测,每 5 分钟刷新 %(prog)s --token YOUR_TOKEN -i 300 -t 3 # 短线模式 %(prog)s --token YOUR_TOKEN --preset scalper # 设置环境变量避免每次输入 token export TUSHARE_TOKEN=YOUR_TOKEN %(prog)s --once """ ) # Tushare 配置 parser.add_argument( '--token', type=str, help='Tushare API Token(也可通过环境变量 TUSHARE_TOKEN 设置)' ) parser.add_argument( '--data-source', choices=['sector', 'lhb'], default='sector', help='数据源:sector(概念板块,默认)或 lhb(龙虎榜每日明细)' ) parser.add_argument( '--trade-date', type=str, metavar='YYYYMMDD', help='交易日期(例如 20260213)。lhb 模式建议显式指定' ) parser.add_argument( '--ts-code', type=str, help='股票 TS 代码(如 002219.SZ),仅 lhb 模式生效' ) # 运行模式 mode_group = parser.add_mutually_exclusive_group() mode_group.add_argument( '--once', action='store_true', help='单次运行模式(仅查询一次)' ) mode_group.add_argument( '--watch', '-w', action='store_true', help='持续监测模式(默认)' ) # 监测参数 parser.add_argument( '--threshold', '-t', type=float, default=3.0, metavar='N', help='涨幅阈值(百分比),默认 3.0%%' ) parser.add_argument( '--top', '-n', type=int, default=10, metavar='N', help='显示排行榜前 N 名,默认 10' ) parser.add_argument( '--interval', '-i', type=int, default=300, metavar='SEC', help='轮询间隔(秒),默认 300(5分钟)' ) # 显示选项 parser.add_argument( '--no-score', action='store_true', help='不显示综合评分榜' ) parser.add_argument( '--no-rank', action='store_true', help='不显示涨幅排行榜' ) parser.add_argument( '--quiet', '-q', action='store_true', help='静默模式,仅显示超过阈值的板块' ) parser.add_arg