Fetch Stock Daily JSON
Use this skill for the publishable Node.js path stock input -> symbol resolution -> daily history fetch -> raw JSON archive.
Quick Start
Run the Node.js helper from the repo root:
CODEBLOCK0
The script prints a JSON summary with the resolved symbol, row count, requested window, actual trade-date bounds, and saved file path.
Workflow
- 1. Accept repo-compatible inputs only: 6-digit code,
600519.SH or 300750.SZ, or a Chinese stock name. Do not use sh600519. - Prefer the bundled Node.js script instead of re-implementing the workflow in the task.
- Resolve stock names through the Eastmoney A-share list API and cache the code-name map locally.
- Fetch daily bars from the Eastmoney historical kline API with
daily period and qfq/hfq/none adjustment. - Save the archived rows under
data/raw/eastmoney/daily_history/YYYYMMDD/<symbol>_<HHMMSS>.json. - Default to
years=5 and adjust=qfq when the user does not provide a date window. - Stop after JSON archive generation unless the user explicitly asks for downstream parsing, analysis, or DB sync.
Return Format
Return the script's JSON summary and call out:
- - INLINECODE9
- INLINECODE10
- INLINECODE11
- INLINECODE12
- INLINECODE13
Failure Handling
- - If name resolution fails, ask for a valid 6-digit A-share code or Chinese stock name.
- If the fetch returns zero rows, keep the archive file and report
rows: 0. - If you need the JS-side API details or the parity notes versus the Python workflow, read
references/lobsterclaw-workflow.md.
技能名称: fetch-stock-daily-json
详细描述:
获取股票每日JSON数据
此技能用于可发布的Node.js路径:股票输入 -> 代码解析 -> 日线历史获取 -> 原始JSON归档。
快速开始
从仓库根目录运行Node.js助手:
bash
node skills/fetch-stock-daily-json/scripts/fetchdailyjson.js 贵州茅台
node skills/fetch-stock-daily-json/scripts/fetchdailyjson.js 600519 --years 3
node skills/fetch-stock-daily-json/scripts/fetchdailyjson.js 宁德时代 --start-date 20240101 --end-date 20260329 --adjust qfq
该脚本会输出包含解析代码、行数、请求时间窗口、实际交易日期范围及保存文件路径的JSON摘要。
工作流程
- 1. 仅接受仓库兼容的输入:6位数字代码、600519.SH或300750.SZ格式,或中文股票名称。禁止使用sh600519格式。
- 优先使用内置的Node.js脚本,而非在任务中重新实现工作流程。
- 通过东方财富A股列表API解析股票名称,并在本地缓存代码-名称映射表。
- 从东方财富历史K线API获取日线数据,支持daily周期及qfq/hfq/none复权方式。
- 将归档数据保存至data/raw/eastmoney/dailyhistory/YYYYMMDD/.json路径。
- 当用户未指定日期窗口时,默认使用years=5和adjust=qfq参数。
- JSON归档生成后即停止,除非用户明确要求后续解析、分析或数据库同步操作。
返回格式
返回脚本的JSON摘要并标注以下内容:
- - resolvedsymbol(解析后的股票代码)
- rows(数据行数)
- tradedatemin(最小交易日期)
- tradedatemax(最大交易日期)
- outputpath(输出文件路径)
异常处理
- - 若名称解析失败,提示用户输入有效的6位A股代码或中文股票名称。
- 若获取结果为零行,保留归档文件并报告rows: 0。
- 如需了解JS端API详情或与Python工作流的差异说明,请参阅references/lobsterclaw-workflow.md。