Install
openclaw skills install @caoling7878-arch/yanmu-financial-dataopenclaw skills install @caoling7878-arch/yanmu-financial-data根据用户选择的股票,采集目标公司及可比公司的核心财务数据,包括:
| 市场 | 支持标的 | 实时行情来源 | API示例 |
|---|---|---|---|
| 🇨🇳 A股 | 600519(茅台)、300750(宁德)、002594(比亚迪)等10支 | 新浪财经 | hq.sinajs.cn/list=sh600519 → 字段[3] |
| 🇭🇰 港股 | 00700(腾讯控股) | 新浪财经 rt_hk | hq.sinajs.cn/list=rt_hk00700 → 字段[6] |
| 🇺🇸 美股 | NVDA(NVIDIA) | 新浪财经 gb_ | hq.sinajs.cn/list=gb_nvda → 字段[1] |
每次运行时自动从新浪财经API获取最新股价,覆盖内置硬编码价格。 采集失败时回退到内置数据库的静态数据(课程演示用)。
| 市场 | 第一优先级 | 回退方案 |
|---|---|---|
| A股 | 新浪财经 hq.sinajs.cn/list=sh/sz | 静态数据库 |
| 港股 | 新浪财经 hq.sinajs.cn/list=rt_hk | 静态数据库 |
| 美股 | 新浪财经 hq.sinajs.cn/list=gb_(代码需全小写) | 静态数据库 |
python3 {baseDir}/scripts/fetch_financial_data.py \
--ticker <股票代码> \
--market <a-share|hk|us> \
--comps <可比公司代码1,可比公司代码2,...> \
--output <json|text>
脚本内置 fetch_live_price() 函数,流程如下:
用户输入 → 加载数据库 → 请求新浪API(5秒超时) → 成功则用实时价覆盖 → 失败则用数据库价
sh600519 / sz300750 → 字段[3]为当前价rt_hk00700 → 字段[6]为当前价gb_nvda → 字段[1]为当前价(代码必须小写)获取实时股价后自动联动更新:
market_cap(市值)= current_price × shares_outstandingpe_ttm(市盈率)= current_price ÷ last_eps输出格式(JSON):
{
"target": {
"name": "公司名",
"market": "a-share|hk|us",
"current_price": "实时股价",
"market_cap": "实时市值",
"history": {"2023": {...}, "2024": {...}, "2025": {...}},
"estimates": {"2026E": {...}, "2027E": {...}, "2028E": {...}},
"valuation": {"pe_ttm": "...", "pb": "...", ...}
},
"comps": {"代码": {...}, ...}
}
nvda 而非 NVDA