A Share Pro
v1.0.0A 股专业监控工具 - 轻量级自选股管理 + 多数据源实时行情。支持腾讯财经/雪球/百度/Tushare 自动切换,纯文本存储,无需数据库依赖。用于日常股票跟踪、自选股管理和投资组合监控。
Security Scan
OpenClaw
Benign
high confidencePurpose & Capability
The code and instructions match the described purpose: local text watchlist management and multi‑source real‑time quotes (Tencent, Xueqiu, Baidu, optional Tushare). One minor inconsistency: SKILL.md emphasizes “no Token dependency”, yet config.py reads an optional TUSHARE_TOKEN from the environment (default empty). This is acceptable as optional functionality but slightly misleading in docs.
Instruction Scope
SKILL.md only instructs installing and running the provided scripts (add/list/remove/summarize). Runtime instructions are scoped to local files and network requests to public data providers. Two portability/maintenance oddities: monitor.py and summarize_performance.py insert a hardcoded absolute path (/Users/wangrx/...) as a fallback sys.path — this is not harmful but indicates the package was packaged from a local dev environment and may fail on other systems. Also the TUSHARE_TOKEN env var is used but not documented in SKILL.md as optional.
Install Mechanism
There is no platform package install spec in the registry metadata, but the bundle includes an install.sh that the user is instructed to run. install.sh runs pip3 install for requests, beautifulsoup4 and pandas (PyPI packages). This is a common moderate‑risk action (it will install packages from PyPI into the environment). The packages and sources are standard and expected for the functionality.
Credentials
The skill declares no required environment variables, which matches the primary behavior. However, config.py reads an optional TUSHARE_TOKEN from the environment — it is not required and defaults to empty. No other secrets or unrelated credentials are requested. Data is stored under the user's home (~/.openclaw/a_share).
Persistence & Privilege
The skill does not request always:true, does not modify other skills, and only creates a data directory under the user's home. Uninstall.sh attempts to remove that data and the skill directory (with an optional backup). These are normal for a user‑installed local skill.
Assessment
This skill appears to do what it says: manage a local A‑share watchlist and fetch quotes from public providers. Before installing: (1) inspect install.sh because it will pip install packages into your environment — consider using a virtualenv. (2) Be aware the code will make outbound HTTP(S) requests to Tencent/Xueqiu/Baidu (and optionally Tushare if you supply TUSHARE_TOKEN). (3) The package contains a couple of hardcoded dev paths (sys.path insert with /Users/wangrx/...), which is harmless but brittle; you may want to remove those lines for portability. (4) If you want to use Tushare, set TUSHARE_TOKEN in your environment; otherwise it remains unused. (5) Backup existing ~/.openclaw/a_share before running uninstall or install if you have important data.Like a lobster shell, security has layers — review code before you run it.
latest
A-Share Pro - A 股投资监控终极版
🎯 核心特性
| 特性 | 说明 |
|---|---|
| ✅ 轻量级 | 纯文本存储,无需数据库 |
| ✅ 多数据源 | 腾讯/雪球/百度/Tushare 自动切换 |
| ✅ 持久化 | 自选股/交易记录本地保存 |
| ✅ 易维护 | 统一配置 + 模块化脚本 |
| ✅ 无 Token 依赖 | 主要使用免费数据源 |
🚀 快速开始
1️⃣ 安装
cd ~/.openclaw/workspace/skills/a-share-pro/scripts
chmod +x install.sh
./install.sh
会自动完成:
- ✅ 创建
~/.openclaw/a_share/数据目录 - ✅ 安装 Python 依赖(requests, beautifulsoup4)
- ✅ 测试基本功能
2️⃣ 添加股票
# 方式一:只输入代码(名称默认"未知")
python3 add_stock.py 600919
# 方式二:指定股票名称
python3 add_stock.py 600919 江苏银行
3️⃣ 查看自选股列表
python3 list_stocks.py
输出示例:
📋 你的自选股:
==================================================
序号 代码 名称
--------------------------------------------------
1 600919 江苏银行
2 600926 杭州银行
3 159681 创业板 ETF
==================================================
共计 3 只股票
4️⃣ 获取行情汇总
python3 summarize_performance.py
输出示例:
======================================================================
💼 A-Share Pro - 自选股实时行情
======================================================================
✅ 600919 - 江苏银行
💰 ¥10.59 +0.10 (+0.95% ) [🐧 腾讯财经]
✅ 600926 - 杭州银行
💰 ¥16.57 +0.08 (+0.49% ) [🐧 腾讯财经]
...
======================================================================
📊 持仓概览:3 只 | 上涨:3 只 | 下跌:0 只
📉 平均涨跌幅:+1.46%
💡 整体趋势:📈 整体偏强
======================================================================
📁 文件结构
a-share-pro/
├── SKILL.md # 主文档
├── README.md # 使用说明
└── scripts/
├── config.py # ⭐ 统一配置
├── monitor.py # ⭐ 核心监控模块
│
├── add_stock.py # 添加股票
├── remove_stock.py # 删除股票
├── list_stocks.py # 查看列表
├── clear_watchlist.py # 清空列表
├── summarize_performance.py# ⭐ 行情汇总
│
└── install.sh / uninstall.sh
🔧 高级用法
从命令行导入多个股票
# 批量添加
for code in 600919 600926 600025; do
python3 add_stock.py $code
done
每日定时检查
# 添加到 crontab(每天收盘后 15:30)
# crontab -e
30 15 * * * cd ~/.openclaw/workspace/skills/a-share-pro/scripts && python3 summarize_performance.py
导出数据到 Excel
# 自定义脚本导出
import pandas as pd
stocks = ['600919', '600926']
data = []
for code in stocks:
from monitor import AShareMonitor
monitor = AShareMonitor()
quote = monitor.get_quote(code)
data.append(quote)
df = pd.DataFrame(data)
df.to_excel('持仓报告.xlsx', index=False)
📊 数据存储格式
watchlist.txt(自选股列表)
600919|江苏银行
600926|杭州银行
159681|创业板 ETF
每行格式:代码 | 名称
transactions.txt(交易记录)
2026-03-05|600919|buy|7.80|5000|备注
2026-03-01|600926|sell|8.50|1000|部分止盈
每行格式:日期 | 代码 | 买卖 | 价格 | 数量 | 备注
🎨 数据源优先级
系统会自动按以下顺序尝试获取数据:
- 🐧 腾讯财经 - 最快最稳定(首选)
- 📱 雪球 - 有市值/市盈率信息
- 🔍 百度股市通 - JSON 格式易解析
- 📈 Tushare - 需要积分(备选)
❓ 常见问题
Q1: 如何修改配置文件?
编辑 scripts/config.py:
WATCHLIST_FILE = "~/.openclaw/a_share/watchlist.txt"
DATA_SOURCES_PRIORITY = ["tencent", "xueqiu"] # 只用腾讯和雪球
REQUEST_DELAY = 0.5 # 请求间隔改为 0.5 秒
Q2: 如何重置自选股?
直接编辑数据文件:
nano ~/.openclaw/a_share/watchlist.txt
# 手动添加/删除股票,或使用 clear_watchlist.py 清空
Q3: 能否查询港股/美股?
目前仅支持 A 股(沪市/深市/科创板)。如需港股/美股,建议增加 Yahoo Finance 或新浪财经接口。
🔮 未来扩展方向
- 技术指标计算(MA/MACD/KDJ)
- K 线图表绘制
- 智能提醒(突破价位推送)
- 持仓盈亏计算(需要成本价)
- 新闻资讯聚合
- Web 可视化界面(Streamlit)
<div align="center"> <strong>A-Share Pro ✨</strong><br> 让 AI 成为你的得力投资助手 📈🤖 </div>
Comments
Loading comments...
