A Stock Lhb Rec logo

A Stock Lhb Rec

Community
smart-open
a-stock-lhb-rec

龙虎榜「后期涨停」个股推荐与自进化模型技能。基于近三个月龙虎榜数据训练逻辑回归模型, 预测个股「上榜后 T+1/T+2/T+3 任一交易日涨停」的概率,收盘后(17:00 后)生成推荐候选, 并据「昨日龙虎榜+今日涨停+今日龙虎榜」持续自我验证与重训,让模型随真实结果累积越来越精准。 特征三维:个股技术面(涨幅/换手/市值/净买/是否涨停/前3日透支/上榜原因)、席位操作手法 (买方质量/家数/买卖净比/游资占比/机构/北向/知名游资/低吸)、行情研判 (题材主线/板块强度/市场涨停情绪/连板强势)。含游资席位画像、紫阳东路专项、模型进化轨迹。 适用:盘后龙虎榜选股、游资后期涨停预判、T+3 买入候选、席位手法分析、模型自迭代优化。

Overview

Publishersmart-open
Repositoryskills
Skill namea-stock-lhb-rec
Stars
23
Forks
5
Bundled files
13
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 13 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by smart-open on GitHub. Read the source before you install it.

Installation

Install the A Stock Lhb Rec AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/smart-open/skills/tree/main/a-stock-lhb-rec
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/smart-open/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/a-stock-lhb-rec .claude/skills/a-stock-lhb-rec
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable A Stock Lhb Rec in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads A Stock Lhb Rec on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so A Stock Lhb Rec is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

龙虎榜 T+3 涨停推荐与自进化模型(a-stock-lhb-rec)

把「龙虎榜上榜个股 → 后期(T+1~T+3)仍有涨停冲高」做成可复用的概率模型。 每天收盘后自动出候选;每天用「昨日推荐 vs 今日实际涨停」验证,并把新实际结果喂回训练, 模型版本随时间外 AUC 不劣则 +1,越用越准。

能力说明

  • 盘后推荐:每个交易日 17:00 后,拉取当日龙虎榜,用当前模型对全部上榜股输出 P(T+3涨停) 并排序,给出「纳入观察」候选(满足 主线+连板+净买比+优质买方+未过度透支)。
  • 低位连板聚焦(执行层):在全量 Top20 之上再叠一层过滤 —— 剔除**高度板(≥3板)**与今日未涨停上榜,只留「刚刚 1-2 板」,按综合分给 Top5。全量 Top20 保留供自学习/回测,聚焦清单供人执行(daily 自动产出)。
  • 三维归因:个股技术 × 席位手法 × 行情研判,可解释(逻辑回归评分卡)。
  • 席位画像:自动构建游资席位画像(打板/低吸/接力风格、EB 收缩综评、样本可信度),含紫阳东路专项解读。
  • 自我进化:optimize 补最新实际结果 → 重训 → 时间外 AUC 不劣于当前则版本 +1,轨迹写入 model_history.json;verify 逐日核对推荐命中率。
  • 模型择优(LR vs GBDT):训练时在同一时间外测试集上比较逻辑回归与梯度提升树,GBDT 明显更优且样本充足(≥300)时自动采用 GBDT 作生产模型,否则回落 LR(稀疏样本下 LR 更稳),模型类型记入 model_kind。
  • 暴雷一票否决:推荐输出阶段对 ST/退市/立案调查/违规处罚/业绩预亏等风险股强制剔除(即使模型概率高也不纳入观察候选)。
  • Markdown 报告:方法论 / 赢家共性 / 席位手法 / 评估 / 评分卡 / 实战验证 / 进化轨迹 / 买入策略(带日期,落 <cwd> 根目录)。

何时使用

  • 用户说「龙虎榜推荐 / 盘后选龙虎榜 / T+3 涨停预测 / 游资后期涨停 / 上榜后还能涨的票」
  • 用户说「每天收盘后给我龙虎榜候选 / 5点后龙虎榜」→ 跑 daily
  • 用户说「优化模型 / 让模型更准 / 模型迭代」→ 跑 optimize
  • 用户说「某席位手法 / 紫阳东路怎么样」→ 看席位画像章节
  • 定时自动化(可选):每个交易日 17:00 后触发 daily;该命令自身已内嵌「生成报告后自动自我学习」,无需另行配置 cron 任务

运行要求(自包含)

依赖说明
Python任意 Python 3.9+ 解释器(python / python3 / py,下称 py)。需预装 pandas/scikit-learn/requests/joblib;若缺失:py -m pip install pandas scikit-learn requests joblib
脚本技能目录内 scripts/*.py(已相对化,BASE 由 __file__ 推导,无需改路径)
运行时产物默认写到当前会话/工作目录下的 <cwd>/a-stock-lhb-rec/(数据+模型+历史),可用环境变量 LHB_RUNTIME 显式指定目录;报告(Markdown,带日期)写到 <cwd> 根目录(可用 LHB_OUT 指定);产物不写回技能安装目录
联网抓取龙虎榜/题材/K线需联网(东财 datacenter + 同花顺 + 腾讯 K线);已有缓存可离线重跑

无需 cd 到特定目录:脚本代码用 BASE = 脚本自身位置的技能根目录 定位,任意位置运行皆可;但运行时产物(数据/模型)默认写到运行时的当前工作目录 <cwd>/a-stock-lhb-rec/(可用 LHB_RUNTIME 指向固定工程目录),报告(Markdown)写到 <cwd> 根目录(可用 LHB_OUT 指定),确保技能库保持纯净。

第一步:首次全量构建(仅一次)

bash
py scripts/run.py init
  • 拉取近 90 天龙虎榜(board / 买卖席位 / 同花顺题材 / 全量日 K线,约 10~15 分钟,增量可断点续跑)
  • 构建席位画像 → 特征集 → 训练首版模型(v1)→ 生成当日推荐 → 生成报告
  • 产物:a-stock-lhb-rec/data/* + a-stock-lhb-rec/model/model_t3.joblib + a-stock-lhb-rec/model_history.json + 龙虎榜T+3涨停推荐模型报告-*.md(报告落 <cwd> 根目录)

第二步:每日盘后主流程(核心,可自动化)

bash
py scripts/run.py daily            # 默认=最近已发布交易日(今天需≥17:00)
py scripts/run.py daily 2026-08-28 # 指定日

daily 依次执行:

  1. pipeline.fetch_latest() —— 增量抓取当日龙虎榜(board/seats/hot/kline,跳过已有)
  2. recommend —— 对当日全部上榜股打分,输出 Top20 候选 + recommend_{日期}.csv
  3. verify —— 核对前 4~10 个交易日(T+3 已完全结算)的推荐实际 T+1/T+2/T+3 涨停,追加 verify_history.csv
  4. report —— 刷新 Markdown 报告(含最新进化轨迹与验证记录)
  5. optimize(自动)—— 生成报告后自动自我学习:把最新实际结果补入训练集、重训、版本决策(时间外 AUC 不劣则 +1),无需额外定时任务

5 点以后逻辑:pipeline.board_ready_day() 在 17:00 前返回上一交易日、17:00 后返回当日,确保龙虎榜数据已发布。

第三步:按需子命令

bash
py scripts/run.py recommend 2026-08-28   # 单日推荐(不抓数据, 用缓存)
py scripts/run.py verify 2026-08-28      # 验证某日推荐命中(需 T+1..T+3 已可得)
py scripts/run.py focus 2026-09-15 5     # 低位连板聚焦: 剔除高度板, 1-2板综合分 TopN(缺省5)
py scripts/run.py optimize               # 手动触发自我进化重训
py scripts/run.py report                 # 重新生成报告(生成后自动触发自我学习)
py scripts/run.py train                   # 仅重训(不抓数据)

低位连板聚焦(1-2 板,执行层)

全量 Top20 用于自学习/回测足够,但给人看太多。focus 在其上再叠一层可执行过滤: 剔除高度板(≥3 板)与今日未涨停上榜,只留「刚刚 1-2 板」,按综合分给 TopN(缺省 5)。 daily 已内嵌该步骤,每天自动产出 低位连板聚焦-{日期}.md,无需单独调用。

综合分口径(各分量归一化到 0~1,可解释): 0.40×P + 0.20×净买比 + 0.18×质量(主线/游资) + 0.12×换手健康 + 0.10×位置 − 透支惩罚 − 纯机构主买惩罚

  • 换手健康:2%~16% 理想;<2% 缩量惜售略扣;>16% 递减,>25% 加速扣分。
  • 惩罚:前3日透支 ≥35% 扣 0.25、25~35% 扣 0.12;纯机构主买 扣 0.18。
  • 连板高度由 K 线逐日向前真实判定(非 CONSEC_ZT 的「近3日涨停天数」上限3 口径),可区分 1 板 / 2 板 / ≥3 板。

自进化机制(为什么越来越准)

daily / init / report 每次生成报告后都会自动运行 optimize 完成自我学习(记录当日数据 → 重训 → 版本决策),全程无需手动或额外 cron 定时任务。

  • 数据闭环:每个交易日 daily 抓取的新龙虎榜,其 T+1/T+2/T+3 实际涨幅随 K 线延伸而「解冻」为标签;optimize 把这些真实结果并入训练集,模型持续吸收近期行情特征。
  • 版本门控(同集可比):train 用按日期 80/20 的时间外切分(测试集均为已可知标签的前瞻样本,杜绝未来泄漏);并在【同一个时间外测试集】上同时评估新旧模型 AUC,新模型不劣于当前(-1% 容差)才接受并版本 +1,否则保留旧模型。避免旧版「不同测试集 AUC 直接比」导致的退化误判。
  • 防未来泄漏(因果特征):causal.py 保证席位质量分与题材主线仅用「截至样本日期」已可观测信息——席位 T+5 表现只计入已结算(结算日≤样本日)的记录,主线题材 TopK 只用该日前的热榜累计;榜单标签统一由 K 线收盘价按板块阈值计算,与 verify 完全同口径。
  • 正则化稳健:训练集内部分层 5 折 CV 自动选 C(不用测试集选超参),并对样本量/正例数过少给出提示。
  • 轨迹可查:a-stock-lhb-rec/model_history.json 记录每版样本量/时间外 AUC/同集旧模型 AUC/Top20 命中/决策;报告第七章展示进化轨迹与逐日验证命中率。
  • 局限:因果化后 AUC 更真实(不会虚高);但弱势市(涨停情绪<10%)模型仍失效,应停用;样本量有限,建议每个交易日跑 daily 保持新鲜。

买入策略(推荐输出口径)

  • 主口径:TopN 概率排序(含 P 值)+当日市场强弱门控。「纳入观察」仅辅助标注(P≥30% 且 前3日透支<38% 且 非纯机构主买),不再用「主线+净买比≥0.55」等硬门槛筛掉高 P 股票(90 日 PIT 回溯证明该框命中 27.3% 低于纯 Top20 的 31.2%)。
  • 回避:纯机构主买 / 前3日透支≥38% / 高位连板≥5 / 科创创业涨停上榜(已充分定价)。
  • 风控:T+1 不涨停即减仓,跌破上榜日收盘止损;弱市(当日上榜涨停占比处于历史低分位)自动降级并提示勿追高。

文件索引

用途路径
统一入口scripts/run.py(init/daily/recommend/verify/optimize/train/report)
共享配置/特征scripts/_common.py(BASE/运行时路径/limit_pct/zt_threshold/is_limit_up/reason_cat/FAMOUS/load_klines/load_model/predict)
因果索引scripts/causal.py(无未来泄漏的席位评分/主线题材 scorer,供特征构建)
数据管道scripts/pipeline.py(fetch board/seats/hot/kline,参数化+增量,含 board_ready_day)
席位画像scripts/seat_profile.py → a-stock-lhb-rec/data/seat_profile.csv(展示口径,含未来 T5;勿用于训练特征)
特征集scripts/dataset.py(build_all/build_date,因果特征+统一K线标签)→ a-stock-lhb-rec/data/model_data_t3.csv
训练+版本scripts/train.py → a-stock-lhb-rec/model/model_t3.joblib + model_meta_t3.json + a-stock-lhb-rec/model_history.json
每日推荐scripts/recommend.py → a-stock-lhb-rec/recommend_{日期}.csv
低位聚焦scripts/focus.py → 剔高度板/只留1-2板 → 低位连板聚焦-{日期}.md + a-stock-lhb-rec/focus_{日期}.csv
验证scripts/verify.py → a-stock-lhb-rec/verify_history.csv
自我进化scripts/optimize.py(抓新数据→重训→版本决策)
报告scripts/report.py → 龙虎榜T+3涨停推荐模型报告-{YYYY-MM-DD}.md(落 <cwd> 根目录)

产物(数据+模型+历史)落在运行时当前工作目录的 <cwd>/a-stock-lhb-rec/(可设 LHB_RUNTIME 指向任意工程目录),报告(Markdown)落在 <cwd> 根目录(可设 LHB_OUT);分发技能时仅打包 SKILL.md + scripts/,产物不入技能目录、不打包。

合规

报告末尾固定声明:「以上基于公开行情整理,仅供复盘参考,不构成投资建议。」

变更日志

  • v1.4.1(2026-09-24)· fetch_hot 增加重试与缺失告警

    • 背景:2026-09-23 的 daily 运行时,题材接口 zx.10jqka.com.cn 遭遇一次瞬时网络拦截(空响应 → Expecting value: line 1 column 1),fetch_hot 仅打印一行 ERR 便静默跳过,导致该日 hot_2026-09-23.json 缺失,当日 Top20 的「主线」标记全为空(题材维度特征丢失,P 值也随之偏移)。
    • 修复:fetch_hot 对每个缺失日期重试 3 次(退避 1.5/3/4.5 秒),全部失败才记入 missed 并打印醒目告警(提示「主线维度将缺失,重跑 daily 会自动补抓」)。
    • 自愈特性说明:因 fetch_hot 以「文件是否存在」为判据,重跑 daily(或 recommend→focus→report)即自动补齐缺失题材并修正标记,无需手工删缓存。
    • 当日处置:补抓 hot_2026-09-23.json(14.8KB)后重跑三件套,主线标记恢复(新华传媒 85.3%、华丽家族 79.8%、南威软件 75.7% 等),低位聚焦 Top5 重排为 胜利精密/雪龙集团/三峡新材/澳弘电子/浩欧博。
  • v1.4.0(2026-09-15)· 新增「低位连板聚焦」(1-2 板 TopN,执行层)

    • 背景:每日全量 Top20 用于自学习足够,但直接给人看太多、且头部常被高位连板(≥3 板)占据,接力风险大。
    • 新增 scripts/focus.py + run.py focus [DATE] [N]:硬剔除 ≥3 板高度板 与 今日未涨停上榜,只留 1-2 板,按综合分给 TopN(缺省 5)。
    • 综合分:0.40×P + 0.20×净买比 + 0.18×质量(主线/游资) + 0.12×换手健康 + 0.10×位置 − 透支惩罚 − 纯机构主买惩罚。
    • 连板高度改用 K 线逐日向前真实判定(consec_boards),修正 CONSEC_ZT「近3日涨停天数、上限3」无法区分 1 板/2 板的局限。
    • daily/init 已内嵌该步骤,自动产出 低位连板聚焦-{日期}.md;全量 Top20 照常保留供自学习。
  • v1.3.3(2026-09-10)· 修复 daily 回溯窗口对同一交易日的重复验证

    • 缺陷:cmd_daily 按自然日回退 4~10 天且跳过周末,同一批次会被多个 back 值回退到同一天(如 9-10 跑批时 9-04 批次被重复验证 3 次)。数据无损(按 date 去重覆盖)但浪费计算与日志冗余。
    • 修复:回溯循环加 seen_dates 集合按交易日去重。
  • v1.3.2(2026-09-09)· 修复 verify 闭环断裂(历史推荐票 K 线不刷新)

    • 缺陷:daily 只对「当日新上榜股」增量拉 K 线,历史推荐票的 K 线缓存停滞在推荐日 T+1 → verify 的 T+2/T+3 收盘价永远缺失,永远判定「尚未结算」,实际命中无法回填,模型无法吸收真实结果。
    • 修复:pipeline.py 新增 refresh_kline()(强制重拉 + 按日期合并去重,保留接口 200 条窗口外历史)与 recent_watch_codes()(近 10 个交易日上榜股 + 全部 recommend 文件中的票);fetch_latest() 每日抓取后自动刷新,失败不阻断主流程。
    • 首批回填(2026-09-03 弱市批次):T+3 命中 19.6%(9/46)、T+1 命中 10.9%(弱市批次,符合「弱市失效」已知局限);116 条真实标签解锁触发重训 → v7(同测试集 AUC 0.701 vs 旧 0.694,接受)。
  • v1.3.0(2026-09-04)· 基于 90 交易日 PIT 回溯诊断的模型优化

    • 去共线:训练特征移除 CHANGE_RATE(与 SEAL_STRENGTH r=0.94)、THEME_MAIN(与 THEME_STRENGTH r=0.69)、LOW_XI(与 REASON_跌幅偏离 完全重复),消除系数互相抵消导致的方向失真。
    • 方向先验:按真实 T+3 单因子 AUC 锁定 SEAL_STRENGTH/CONSEC_ZT/LB_FLAG/NET_BUY_RATIO/IS_LIMIT_UP/THEME_STRENGTH 为正、BUYER_MEAN_SCORE/HAS_INST/SELLER_MEAN_SCORE/TURNOVERRATE 为负(符号冲突归零);BUYER_TOP_SCORE 权重收缩至 30%(原 -0.187 过强)。
    • 决策口径:主交付从「纳入观察手工框」改为「TopN 概率排序」为主,「纳入观察」仅作辅助标注(放宽主线+净买比硬门槛)。
    • 市场门控:recommend 新增当日市场强弱判定(按上榜涨停占比的历史分位),弱市自动降级提示;报告主监测口径改为「滚动 Top20(近似 PIT 平均命中)」。
    • 效果:滚动 Top20 命中 33.8% → 35.0%(同一 4-fold walk-forward 口径),尾部 Top20 45% → 50%。
  • v1.3.1(2026-09-04)· 修复特征口径不一致(训练/评估/生产统一 one-hot)

    • 缺陷:train.py 生产模型含 REASON_* 上榜原因 one-hot 特征(29 维),但时间外评估与 walk-forward 却用未 one-hot 的 21 维数值特征,导致 AUC/Top20 口径错位(v3~v5 的 top20_wf=40%、top20=55% 为虚高值)。
    • 修复:main() 统一对 df 做 one-hot,evaluate/walk_forward/train_full 全部使用同一 29 维特征;_common.prep_features 兼容已 one-hot 的 DataFrame。
    • 效果(真实口径):时间外 AUC 0.671 → 0.694,滚动 Top20 35.0%、尾部 Top20 50.0%。
  • v1.2.0:因果特征(消除未来泄漏)+ LR/GBDT 同集择优 + walk-forward 双门控。

  • v1.1.0:席位画像、紫阳东路专项、暴雷一票否决。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the A Stock Lhb Rec AI skill do?

龙虎榜「后期涨停」个股推荐与自进化模型技能。基于近三个月龙虎榜数据训练逻辑回归模型, 预测个股「上榜后 T+1/T+2/T+3 任一交易日涨停」的概率,收盘后(17:00 后)生成推荐候选, 并据「昨日龙虎榜+今日涨停+今日龙虎榜」持续自我验证与重训,让模型随真实结果累积越来越精准。 特征三维:个股技术面(涨幅/换手/市值/净买/是否涨停/前3日透支/上榜原因)、席位操作手法 (买方质量/家数/买卖净比/游资占比/机构/北向/知名游资/低吸)、行情研判 (题材主线/板块强度/市场涨停情绪/连板强势)。含游资席位画像、紫阳东路专项、模型进化轨迹。 适用:盘后龙虎榜选股、游资后期涨停预判、T+3 买入候选、席位手法分析、模型自迭代优化。

Why use A Stock Lhb Rec on TypingMind?

Because you install it once and use it with any model. A Stock Lhb Rec is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install A Stock Lhb Rec in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/smart-open/skills/tree/main/a-stock-lhb-rec. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use A Stock Lhb Rec?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with A Stock Lhb Rec?

As many as you like. As long as a model supports skills, you can use A Stock Lhb Rec with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the A Stock Lhb Rec AI skill free?

It is published on GitHub by smart-open. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇