Imported from quantskills/skill-quant-factor-skill-factory (
SKILL.md). Install upstream withnpx skills add quantskills/skill-quant-factor-skill-factory. Copyright stays with the author (GPL-3.0-only).
{
"version": 1,
"task": {
"placeholder": "请说明要生成或维护的 OHLCV 因子技能主题、现有索引与输出要求",
"required": true
},
"fields": [
{
"key": "count",
"label": "生成数量",
"type": "number",
"default": "10",
"required": true
},
{
"key": "start_id",
"label": "起始因子 ID",
"type": "number",
"placeholder": "例如:1001"
},
{
"key": "market",
"label": "验证市场",
"type": "select",
"default": "both",
"options": [
{ "value": "both", "label": "A 股与美股" },
{ "value": "cn", "label": "A 股" },
{ "value": "us", "label": "美股" }
]
}
],
"prompt_template": "{{#task}}任务与材料:\n{{task}}\n\n{{/task}}{{#attachments}}用户上传的材料(已放入工作区):\n{{attachments}}\n\n{{/attachments}}使用量化因子技能工厂生成 {{count}} 个框架无关的 OHLCV 因子 Skill。{{#start_id}}从起始 ID {{start_id}} 起生成;{{/start_id}}未指定起始 ID 时按既有索引推断下一个可用编号。并在 {{market}} 真实缓存行情上验证;生成前检查既有索引避免重复,确保每个目录具备规定的技能说明、双语文档、因子与验证脚本、真实验证结果、公式参考和适配文件,核验通过数、数据供应商、市场覆盖、合并索引重复数及抽样验证结果,输出中文报告。"
}
Skill Quant Factor Skill Factory
Use this QuantSkills organization Skill when the user wants to create, extend, or maintain a library of framework-neutral quant factor Skills from OHLCV data.
The standard contract is:
- Factors are framework-neutral Python Skills for the QuantSkills organization.
- Users bring their own market data; generated factor code only requires
open,high,low,close,volume, plus optionaldate,symbol, andmarket. - Validation must use cached real OHLCV data when available. Do not describe synthetic validation as real validation.
- For China data, prefer AkShare A-share cache. For US data, prefer Yahoo Finance cache.
- Every generated factor folder must include
SKILL.md, bilingualREADME.md,scripts/factor.py,scripts/validate.py,validation_real/result.json,validation_real/report.md,references/formula.md, andagents/openai.yaml. - Before delivery, verify uniqueness across all previous factor indexes and confirm the generated package is complete.
Workflow
-
Inspect the current project state:
Get-ChildItem Get-Content .\real_market_data\panels\panel_manifest.json -
Confirm the real data panel contains market and vendor evidence:
{ "markets": {"cn": 98, "us": 50}, "sources": ["akshare", "yahoo"] }Exact counts can vary by project, but the report must state the actual counts.
-
Generate the next batch with the reusable script.
If the project already has
tools/real_data_factor_pipeline.py, copy onlyscripts/generate_factor_skill_batch.pyfrom this skill into the project'stools/folder. If not, copy the validated pipeline scripts from a previous project first, then adapt data download paths.Example:
$env:PYTHONUTF8='1' python .\tools\generate_factor_skill_batch.py ` --count 200 ` --start-id 1001 ` --existing-index .\real_data_factor_skills_all_1000_index.json ` --output-root .\real_data_factor_skills_extra_200_next ` --combined-index .\real_data_factor_skills_all_1200_index.json ` --report-name extra_200_next_factor_evaluation_report.md -
Run validation and acceptance checks:
python -m py_compile .\tools\generate_factor_skill_batch.py python .\tools\generate_factor_skill_batch.py --count <N> --start-id <ID> --existing-index <index.json> --output-root <folder> --combined-index <index.json> --report-name <report.md> -
Audit the output:
- Count generated factor directories equals the requested count.
validation_summary_real.jsonhas the requested count.- All rows have
status == "pass"unless the user explicitly accepts review rows. - All rows show the expected real-data market coverage.
- Combined index has no duplicate
slug. - Run
scripts/validate.pyfor the first, middle, and last generated factor folders.
Output Summary
Always finish with:
- output folder
- factor ID range
- pass count
- real data panel counts and market vendors
- combined index count and duplicate count
- report path
- sampled
scripts/validate.pyresult
Important Guardrails
- Do not claim Yahoo data is present unless
real_market_data/raw/yahoo_us/*.parquetand the panel manifest prove it. - Do not overwrite previous batches unless the user asks for regeneration.
- Use UTF-8 when reading or writing Chinese filenames and Markdown: set
PYTHONUTF8=1in PowerShell.