Joinquant Skill 标志

Joinquant Skill

社区
gaaiyun
joinquant-skill

为 JoinQuant(聚宽)平台生成准确且可运行的量化策略代码。用户要求在 JoinQuant 上编写股票/ETF/期货的回测、模拟交易或实盘交易策略时使用。该技能可按需渐进式调用完整的 JoinQuant API 知识库(14 个类别,294KB 官方文档)、5 个可用于生产环境的策略模板(单股均线、多因子、ETF 轮动、动量、均值回归),以及一个可检测虚构 API、未来函数违规及未设置价格模式/滑点/佣金的 lint 工具。兼顾中文使用习惯。使用此技能生成的代码可直接粘贴到 JoinQuant 在线编辑器中,无需修改。

概览

发布者gaaiyun
代码仓库joinquant-skill
技能名称joinquant-skill
星标数
91
复刻数
19
附带文件
88
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 88 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 gaaiyun 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Joinquant Skill AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/gaaiyun/joinquant-skill/tree/main
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/gaaiyun/joinquant-skill.git \
  .claude/skills/joinquant-skill
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Joinquant Skill,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Joinquant Skill。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Joinquant Skill 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

JoinQuant Skill

Generate quantitative strategy code that runs on the JoinQuant platform without modification.

When to Use This Skill

Yes:

  • Stock backtest / paper trading / live trading on JoinQuant (聚宽)
  • ETF rotation, multi-factor stock selection, momentum, mean reversion strategies
  • Futures (期货) strategies on JoinQuant
  • Margin trading (融资融券) strategies
  • Strategy code review / lint to catch hallucinated APIs and future-function violations
  • Translating a strategy idea into JoinQuant API calls

No:

  • Local data analysis without JoinQuant (use jqdatasdk directly, or pandas/numpy)
  • Strategy backtesting on other platforms (vectorbt, backtrader, vn.py — use those skills instead)
  • Pure machine learning model training (no JoinQuant-specific API needed)
  • Live trading on broker APIs other than JoinQuant simulated trading (CTP, Interactive Brokers, etc. need different skills)

Default Mode

Most user requests fall into one of three patterns. Detect the pattern first, then route:

PatternTriggerAction
Quick code"帮我写一个 X 策略" / "用聚宽实现 Y"Pick template, fill in user-specific parts, return ready-to-paste code
API question"聚宽里 get_price 的 fq 参数是什么意思" / "set_option 都有哪些选项"Load matching references/XX-*.md and answer based on it
Code review"帮我审一下我这段聚宽代码" / paste of existing codeRun mental strategy_lint.py against it (or actually call it), point out hallucinated APIs and missing safeguards

Progressive Disclosure: 14 API Categories

DO NOT load all references at once (294KB total, would burn context). Pattern-match the user request and load only the relevant category file:

CategoryReference fileTriggered by keywords
策略设置references/01-strategy-setup.mdinitialize, set_benchmark, set_option, set_order_cost, set_slippage, run_daily, run_weekly, run_monthly
数据获取references/02-data-getters.mdget_price, attribute_history, history, get_current_data, get_fundamentals, get_money_flow, get_concept, get_industry
jqlib 因子库references/03-jqlib.mdalpha101, alpha191, technical_analysis, jqfactor
数据处理references/04-data-processing.mdget_factor_values, calc_factor_history, neutralize, winsorize, standardlize
组合优化references/05-portfolio-optimization.mdoptimizer, max_sharpe, min_variance, target_return, mean_variance
交易函数references/06-trading.mdorder, order_value, order_target, order_target_value, cancel_order, get_open_orders
对象references/07-objects.mdOrder, Position, Portfolio, OrderCost, OrderStyle, MarketOrderStyle, LimitOrderStyle
其他函数references/08-misc-functions.mdrecord, log, write_file, send_message
多投资组合references/09-multi-portfolio.mdset_subportfolios, SubPortfolioConfig, transfer_cash
Tick 级references/10-tick-strategy.mdtick, get_ticks, every_tick
融资融券references/11-margin-trading.mdmargincash_open, margincash_close, marginsec_open, marginsec_close, set_margin_rate
期货references/12-futures.mdget_dominant_future, futures, set_future_commission
归因分析references/13-attribution-analysis.mdbrinson, factor analysis, attribution
引擎机制references/14-strategy-engine.md撮合, 复权, 滑点, 税费, 风险指标, alpha, beta, sharpe, max drawdown

If the user mentions a function name not in any keyword list, use scripts/api_search.py <keyword> to find it across all references.

Templates

5 production-ready templates in templates/:

TemplateWhen to use
01-basic-single-stock.pyFirst-time users, single stock, simple MA crossover. The "hello world" of JoinQuant.
02-multi-factor.pyMulti-factor stock selection (PE / market cap / momentum), monthly rebalance. Most common "real" strategy structure.
03-etf-rotation.pyETF rotation by momentum ranking. Popular among retail investors.
04-momentum-stock.pyCross-sectional momentum on stock pool, weekly rebalance.
05-mean-reversion.pyBollinger / RSI mean reversion. Volatility-aware.

When generating code, start from a template, modify, do not write from scratch. Reasons:

  1. Templates already include the boilerplate (set_benchmark, set_option, set_order_cost, set_slippage)
  2. Templates have correct timing (run_daily / run_weekly with proper time arg)
  3. Templates avoid future-function pitfalls (count-based instead of date-based slicing)

Lint Tool

Before returning generated code to user, mentally (or actually) run strategy_lint.py:

bash
python scripts/strategy_lint.py <user_strategy.py>

Critical checks:

  • ❌ Hallucinated API calls (e.g., jqdata.get_stock_data() doesn't exist)
  • ❌ Future function: using non-count get_price or attribute_history with hardcoded future dates
  • ❌ Missing set_option('use_real_price', True) (mandatory for accurate backtest)
  • ❌ Missing set_order_cost(...) and set_slippage(...)
  • ❌ Order placed in before_trading_start / after_trading_end (forbidden, will be rejected)
  • ❌ Use of deprecated APIs (update_universe etc.)
  • ⚠️ Recommend g. global vars for state across bars instead of module globals
  • ⚠️ Recommend cluster-aware sizing for high-correlation assets

Things That Must Survive Generation

When advising on a strategy, never lose:

  • Always set use_real_price=True. Traditional pre-adjusted price has future-function bias. This is non-negotiable.
  • set_order_cost and set_slippage are mandatory. Without them, backtest is unrealistic and will mislead the user.
  • run_daily time argument matters. 'open' runs at 09:30, 'every_bar' runs every bar (minute or daily). Wrong choice causes wrong execution timing.
  • g. is the only safe global state. Module-level globals can leak across runs in some JoinQuant environments.
  • order_value > order for capital management. Computing share count manually is error-prone with stock splits.
  • order_target_value for rebalancing, never compute "current value - target value" yourself.
  • Don't pip install anything inside JoinQuant. The platform is sandboxed; only its preinstalled libraries work.

Workflow

A typical end-to-end strategy session:

1. User describes idea in natural language
2. AI: pick matching template (e.g., 03-etf-rotation.py)
3. AI: ask 2-3 clarifying questions:
   - 标的池范围(指数成分 / 自定义列表)
   - 调仓频率(日 / 周 / 月)
   - 风险控制(止损 / 仓位上限 / 行业中性)
4. AI: generate strategy code modifying template
5. AI: run mental lint (or actual) — fix issues
6. User: paste into JoinQuant online editor, click 编译运行
7. If errors: re-load relevant references/XX-*.md, fix
8. User: review backtest curve, iterate

For high-stakes (live trading) strategies, additionally:

  • Reference references/14-strategy-engine.md for slippage, commission, risk metrics
  • Reference references/11-margin-trading.md if leverage involved
  • Discuss model risk explicitly (overfitting, regime change, transaction cost realism)

Files

FileRole
README.mdProject intro
WORKFLOW.mdStrategy development end-to-end (✅ complete)
INSTALL_CN.mdChinese install guide (✅ complete)
api文档/api.txtOriginal 294KB API docs (raw backup)
references/01-14-*.md14 progressive-disclosure category files (✅ all complete)
templates/01-05-*.py5 production templates (✅ complete)
scripts/strategy_lint.pyLint tool — black/whitelist hybrid (✅ operational)
scripts/strategy_scaffold.pyGenerate scaffold from description (✅ operational)
scripts/api_search.pySearch API by keyword (✅ operational)
examples/case-mean-reversion/End-to-end case: RSI mean reversion (✅)
examples/case-etf-rotation/End-to-end case: ETF monthly rotation (✅)
examples/bad-strategy-for-lint-test.pyNegative-test sample for lint regression (✅)
factors/(v2) Barra-style factor library, 7 categories
factor_lab/(v2) Single-factor IC / grouping / decay analysis
research_importer/(v2) Brokerage research PDF → JoinQuant code
jqskill_mcp/(v2) MCP server exposing all skill capabilities
tests/pytest (50+ tests passing after v2)

This skill is at version 0.5.0 as of 2026-04-19. All 14 references + 5 templates + 3 scripts + 13 tests + WORKFLOW + 2 examples complete.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

还有 28 个文件。

常见问题

Joinquant Skill AI 技能有什么作用?

为 JoinQuant(聚宽)平台生成准确且可运行的量化策略代码。用户要求在 JoinQuant 上编写股票/ETF/期货的回测、模拟交易或实盘交易策略时使用。该技能可按需渐进式调用完整的 JoinQuant API 知识库(14 个类别,294KB 官方文档)、5 个可用于生产环境的策略模板(单股均线、多因子、ETF 轮动、动量、均值回归),以及一个可检测虚构 API、未来函数违规及未设置价格模式/滑点/佣金的 lint 工具。兼顾中文使用习惯。使用此技能生成的代码可直接粘贴到 JoinQuant 在线编辑器中,无需修改。

为什么在 TypingMind 中使用 Joinquant Skill?

因为您只需安装一次,就能搭配任何模型使用。Joinquant Skill 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Joinquant Skill?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/gaaiyun/joinquant-skill/tree/main。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Joinquant Skill?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Joinquant Skill 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Joinquant Skill 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Joinquant Skill AI 技能免费吗?

gaaiyun 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇