Smart Strategy Stock Picking logo

Smart Strategy Stock Picking

CommunityPopular
qusong0627
smart-strategy-stock-picking

智能策略选股 — 基于 QuantDB 数据的条件选股。在 QuantBot / Claude Code 中按自然语言或条件筛选股票、构建股票池、生成策略时使用。触发词:筛选股票、股票池、条件选股、智能策略、按条件选股、自然语言选股、帮我选出

Overview

Publisherqusong0627
RepositoryQuantMind
Skill namesmart-strategy-stock-picking
Stars
1.7K
Forks
387
Bundled files
Instructions only
LicenseAGPL-3.0
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.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by qusong0627 on GitHub. Read the source before you install it.

Installation

Install the Smart Strategy Stock Picking 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/qusong0627/QuantMind/tree/master/skills/smart-strategy-stock-picking
  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/qusong0627/QuantMind.git /tmp/QuantMind
mkdir -p .claude/skills
cp -r /tmp/QuantMind/skills/smart-strategy-stock-picking .claude/skills/smart-strategy-stock-picking
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Smart Strategy Stock Picking 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 Smart Strategy Stock Picking 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 Smart Strategy Stock Picking 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.

⚙️ 本技能遵循公共运行环境契约(最高优先级,先于本文其余内容执行): 详见 _shared/env-contract.md,执行前先读它。

智能策略选股技能

基于 QuantDB 数据的条件选股。支持自然语言、结构化条件、DSL 三种方式,选出符合要求的股票池并附带量化指标。

数据基础

选股完全基于 QuantDB 本地 parquet。字段映射以后端字典为准:backend/services/engine/ai_strategy/steps/step1_stock_selection.py(DSL 字段 → QuantDB 表/列),覆盖以下数据源:

QuantDB 数据源字段覆盖
l1_factors66动量/流动性/概念热度/资金流
technical_indicators24均线/RSI/KDJ/MACD/波动率
financial20财务指标
valuation15PE/PB/市值/ROE
sentiment14市场情绪
margin10融资融券
stock_list6行业/ST/上市天数
daily/turnover3量价

认证

bash
BASE=http://127.0.0.1:8000
TOKEN=$(curl -s -X POST $BASE/api/v1/auth/login -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"admin123","tenant_id":"default"}' \
  | python3 -c "import sys,json; print(json.load(sys.stdin).get('access_token',''))")
AUTH="Authorization: Bearer $TOKEN"
CT="Content-Type: application/json"

1. 常用选股因子(前 30 高频字段)

字段含义单位
market_cap / total_mv总市值亿
float_mv流通市值亿
pe / pe_ttm市盈率—
pb市净率—
roe净资产收益率%
close收盘价元
pct_change当日涨跌幅%
turnover_rate换手率%
ma5 / ma10 / ma20 / ma60均线元
ma_gap_5 / ma_gap_20均线偏离度%
rsi_6 / rsi_14RSI—
kdj_k / kdj_d / kdj_jKDJ—
macd_dif / macd_dea / macd_histMACD—
future_return_1d / future_return_3d / future_return_5d / future_return_20d / future_return_60d未来 N 日收益(标签,勿作过滤)%
vol_std_5 / vol_std_20 / vol_std_60波动率%
vol_atr_1414日ATR—
beta_2020日Beta—
volume_ratio_5 / volume_ratio_20量比—
main_flow主力资金净流入元
flow_net_amount资金净流入总额万元(2026-09 起;读入归一为元)
inst_ownership机构持仓%
concept_ai / concept_chip 等概念热度—
industry行业—
is_st是否ST—
listed_days上市天数天

完整字段清单与映射以后端字段字典为准(backend/services/engine/ai_strategy/steps/step1_stock_selection.py + api/schemas/stock_pool.py)。⚠️ 前端 electron/src/features/strategy-wizard/factors/dictionary.ts 已移除,勿再引用。

2. 方式一:自然语言解析(推荐给用户用)

bash
# 解析自然语言为 DSL(内部:可先用此步确认字段能否被识别)
curl -s -X POST "$BASE/api/v1/strategy/parse-text" -H "$AUTH" -H "$CT" \
  -d '{"text":"市值大于500亿且ROE大于15%的沪深300成分股,剔除ST"}' \
  -o /tmp/pt.json -w "HTTP %{http_code}\n"
cat /tmp/pt.json | python3 -m json.tool --no-ensure-ascii | head -30

3. 方式二:结构化条件解析(最可控)

bash
curl -s -X POST "$BASE/api/v1/strategy/parse-conditions" -H "$AUTH" -H "$CT" \
  -d '{"conditions":{"type":"numeric","factor":"pe","operator":"<","threshold":15}}' \
  -o /tmp/pc.json -w "HTTP %{http_code}\n"
cat /tmp/pc.json | python3 -m json.tool --no-ensure-ascii

条件结构:

  • 数值条件:{"type":"numeric","factor":"pe","operator":"<|<=|>|>=|=","threshold":15}
  • 趋势条件:{"type":"trend","factor":"ma5","window":5,"direction":"above|below"}
  • 复合条件:{"type":"composite","op":"and|or","children":[...]}(可嵌套)

返回:dsl(如 SELECT symbol WHERE pe < 15)+ mapping + quantdb_filters(如 [{field:"pe_ttm", operator:"<", value:15, table:"quantdb_valuation"}])

4. 方式三:DSL 直接查询(执行选股)

bash
curl -s -X POST "$BASE/api/v1/strategy/query-pool" -H "$AUTH" -H "$CT" \
  -d '{"dsl":"SELECT symbol WHERE pe < 15 AND roe > 10","market":"CN","exchange":"SH"}'

参数:

  • dsl:SELECT symbol WHERE 条件 [AND/OR 条件...](字段用上面的因子名)
  • market:CN / HK / US / CRYPTO
  • exchange:SH / SZ / BJ(仅 A 股)

返回:items(每只股票 symbol/name/metrics,metrics 含市值/PE/ROE 等)+ summary(matchRate/totalCandidates/universeTotal/asOf)

5. 实战示例(可直接复用)

5.1 低估值蓝筹(PE<15 且 市值>500亿)

bash
curl -s -X POST "$BASE/api/v1/strategy/query-pool" -H "$AUTH" -H "$CT" \
  -d '{"dsl":"SELECT symbol WHERE pe < 15 AND market_cap > 500 AND roe > 10","market":"CN"}'

5.2 动量强势(过去 20 日收益>10% 且 RSI>60)

bash
curl -s -X POST "$BASE/api/v1/strategy/query-pool" -H "$AUTH" -H "$CT" \
  -d '{"dsl":"SELECT symbol WHERE mom_ret_20d > 0.10 AND rsi_14 > 60 AND turnover_rate < 20","market":"CN"}'

勿用 future_return_*(旧名 return_*)做选股过滤——那是未来收益标签,会造成泄漏。

5.3 高波动小盘(波动大 + 市值小)

bash
curl -s -X POST "$BASE/api/v1/strategy/query-pool" -H "$AUTH" -H "$CT" \
  -d '{"dsl":"SELECT symbol WHERE vol_std_20 > 5 AND market_cap < 100 AND pct_change > 0","market":"CN"}'

5.4 资金流入 + 概念热门(AI/半导体)

bash
curl -s -X POST "$BASE/api/v1/strategy/query-pool" -H "$AUTH" -H "$CT" \
  -d '{"dsl":"SELECT symbol WHERE main_flow > 10000000 AND concept_ai > 0.5","market":"CN"}'

5.5 剔除 ST + 特定行业 + 换手活跃

bash
curl -s -X POST "$BASE/api/v1/strategy/query-pool" -H "$AUTH" -H "$CT" \
  -d '{"dsl":"SELECT symbol WHERE is_st = false AND industry = 半导体 AND turnover_rate BETWEEN 3 AND 15","market":"CN"}'

6. 分析建议

选出的股票池可结合其他技能深入分析:

  • 查新闻:/news/articles 带 tickers 看利好/利空 → [[quantmind-operations]] 第 7 节
  • 查推理分数:/models/inference/stock/{symbol}/history 看模型评分
  • 挖新因子:[[rd-agent-factor-mining]] 补充更多筛选维度
  • 训练模型:选出的池子可喂给模型训练 → [[quantmind-operations]] 第 1 节

7. 常见问题

现象原因处理
422 字段不匹配DSL 用了映射表外字段用上面的常用因子名,或查后端字典 step1_stock_selection.py
选股结果为空条件过严放宽阈值,或去掉 AND 条件
summary.matchRate 极低条件偏窄检查 totalCandidates 是否正常
想要全市场dsl 用 SELECT symbol WHERE true返回全部候选

Frequently asked questions

What does the Smart Strategy Stock Picking AI skill do?

智能策略选股 — 基于 QuantDB 数据的条件选股。在 QuantBot / Claude Code 中按自然语言或条件筛选股票、构建股票池、生成策略时使用。触发词:筛选股票、股票池、条件选股、智能策略、按条件选股、自然语言选股、帮我选出

Why use Smart Strategy Stock Picking on TypingMind?

Because you install it once and use it with any model. Smart Strategy Stock Picking 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 Smart Strategy Stock Picking in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/qusong0627/QuantMind/tree/master/skills/smart-strategy-stock-picking. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Smart Strategy Stock Picking?

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 Smart Strategy Stock Picking?

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

Is the Smart Strategy Stock Picking AI skill free?

Yes. It is published on GitHub by qusong0627 under the AGPL-3.0 license. 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 👇