a-stock-monitorA股量化监控系统 - 7维度市场情绪评分、智能选股引擎(短线5策略+中长线7策略)、实时价格监控、涨跌幅排行榜。支持全市场5000+股票数据采集与分析,多指标共振评分,精确买卖点计算,动态止损止盈。每日自动推荐短线3-5只、中长线5-10只优质股票。包含Web界面、自动化Cron任务、历史数据回溯。适用于A股量化...
Install via ClawdBot CLI:
clawdbot install jame-mei-ltp/a-stock-monitor一个完整的A股量化选股、实时监控与市场情绪分析系统。
作者: James Mei
邮箱: meijinmeng@126.com
博客: https://www.cnblogs.com/Jame-mei
版本: 1.1.2
许可证: MIT
详见:CHANGELOG.md
基于全市场5000+只A股的综合情绪评分(0-100分):
5大策略,每日推荐3-5只短线机会股:
多指标共振评分体系 (满分100分):
精确买卖点:
7大策略,每日推荐5-10只优质股票:
综合评分维度:
持仓建议:
pip3 install akshare flask ccxt
编辑 web_app.py,修改 WATCHED_STOCKS 列表:
WATCHED_STOCKS = [
'600900', # 长江电力
'601985', # 中国核电
# 添加更多股票代码...
]
cd scripts/
python3 web_app.py
访问 http://localhost:5000
设置Cron任务(交易时间每5分钟更新):
openclaw cron add --name "A股全市场数据更新" \
--schedule "*/5 9-15 * * 1-5" \
--tz "Asia/Shanghai" \
--payload '{"kind":"systemEvent","text":"cd <skill-path>/scripts && python3 smart_market_updater.py"}'
替换 为技能安装路径。
# 更新全市场数据
python3 scripts/update_all_market_data.py
# 计算市场情绪
python3 scripts/market_sentiment.py
# 智能更新(仅交易时间)
python3 scripts/smart_market_updater.py
# 检查交易时间
python3 scripts/is_trading_time.py
# 短线选股(每日推荐3-5只)
python3 scripts/short_term_selector.py
# 中长线选股(每日推荐5-10只)
python3 scripts/long_term_selector.py
# 增强版中长线选股
python3 scripts/enhanced_long_term_selector.py
scripts/
├── web_app.py # Flask Web服务
├── stock_cache_db.py # SQLite数据缓存
├── stock_async_fetcher.py # 异步数据获取
├── market_sentiment.py # 市场情绪计算
├── is_trading_time.py # 交易时间判断
├── smart_market_updater.py # 智能更新器
├── update_all_market_data.py # 全市场数据更新
├── short_term_selector.py # 短线选股引擎
├── long_term_selector.py # 中长线选股引擎
├── enhanced_long_term_selector.py # 增强版中长线选股
├── strategy_config.py # 策略配置文件
└── templates/
└── index.html # Web前端页面
返回全市场情绪评分
响应示例:
{
"score": 57,
"level": "偏乐观",
"emoji": "🟢",
"description": "市场偏强,情绪稳定",
"stats": {
"total": 5000,
"gainers": 2460,
"losers": 2534,
"limit_up": 15,
"limit_down": 3
}
}
返回所有监控股票数据
返回监控股票实时价格(轻量级)
返回单只股票详情
默认交易时间:周一至周五 9:15-15:00
修改 is_trading_time.py:
TRADING_HOURS = {
'morning': (9, 15, 11, 30), # 9:15-11:30
'afternoon': (13, 0, 15, 0), # 13:00-15:00
}
SQLite数据库:stock_cache.db
默认缓存时间:30分钟
修改 stock_cache_db.py:
MAX_AGE_MINUTES = 30 # 缓存有效期
编辑 web_app.py 中的 WATCHED_STOCKS 列表
修改 market_sentiment.py:
# 情绪等级阈值
LEVELS = [
(80, 100, '极度乐观', '🔴'),
(65, 79, '乐观', '🟠'),
(55, 64, '偏乐观', '🟢'),
# ...
]
原因: 非交易时间,akshare返回空数据
解决: 等待交易时间,或导入演示数据
原因: 数据库无有效数据
解决: 运行 python3 update_all_market_data.py
原因: 时区配置错误
解决: 确保时区设置为 Asia/Shanghai
原因: Flask默认端口5000冲突
解决: 修改 web_app.py 中的端口号
编辑 market_sentiment.py,添加新的评分维度:
def calculate_sentiment(stocks):
# 添加新维度
new_dimension_score = calculate_new_dimension(stocks)
# 调整权重
score = (
gain_ratio_score * 0.18 + # 降低原有权重
# ...
new_dimension_score * 0.10 # 新维度10%
)
创建新的告警脚本:
def check_custom_alert():
cache = StockCache()
stocks = cache.get_all_stocks()
# 自定义告警逻辑
alerts = []
for stock in stocks:
if stock['change_pct'] > 5:
alerts.append(stock)
if alerts:
send_alert(alerts)
MIT License
欢迎反馈问题、建议和改进意见!
Generated Mar 1, 2026
Individual traders use the system to automate stock selection and monitoring, leveraging its 7-dimensional market sentiment scoring and real-time price updates to make informed short-term (1-5 days) and medium-to-long-term (20-180 days) investment decisions. It helps reduce emotional bias by providing data-driven recommendations and dynamic stop-loss/profit-taking calculations.
Financial advisors or wealth management firms integrate the skill to enhance their stock analysis capabilities, offering clients daily recommendations and market insights. The Web interface allows for easy visualization of market trends and monitored stocks, supporting client presentations and portfolio management discussions.
Educational institutions or online course providers use this system as a practical tool to teach A-share market analysis, quantitative strategies, and technical indicators. Students can run simulations, analyze historical data, and understand real-time market dynamics through the automated cron tasks and data visualization features.
Small to medium-sized investment firms utilize the skill for internal research and screening of over 5,000 A-share stocks, using its multi-strategy selection engines to identify potential opportunities. The system's performance optimizations and dual data sources ensure reliable data during trading hours for quick decision-making.
Tech-savvy individuals set up the Web interface as a personalized dashboard to track a custom watchlist of stocks, receiving alerts via Feishu or WeChat. It automates data updates and provides sentiment scores, helping users stay informed without constant manual checking during market hours.
Offer the skill as a cloud-based service with tiered subscriptions, providing access to advanced features like enhanced selection strategies, historical data analytics, and priority support. Revenue is generated through monthly or annual fees from individual traders and small firms.
Provide a free basic version with core functionalities like market sentiment scoring and limited stock monitoring, while charging for premium add-ons such as automated alerts, advanced strategy configurations, and API access for integration into other trading platforms.
License the skill as a white-label product to banks, brokerages, or fintech companies, allowing them to rebrand and customize it for their clients. Revenue comes from licensing fees, customization services, and ongoing maintenance contracts tailored to institutional needs.
💬 Integration Tip
Ensure Python dependencies are installed and configure cron tasks correctly for automated updates during Shanghai trading hours to maintain data accuracy.
Automatically update Clawdbot and all installed skills once daily. Runs via cron, checks for updates, applies them, and messages the user with a summary of what changed.
Full desktop computer use for headless Linux servers. Xvfb + XFCE virtual desktop with xdotool automation. 17 actions (click, type, scroll, screenshot, drag,...
Essential Docker commands and workflows for container management, image operations, and debugging.
Tool discovery and shell one-liner reference for sysadmin, DevOps, and security tasks. AUTO-CONSULT this skill when the user is: troubleshooting network issues, debugging processes, analyzing logs, working with SSL/TLS, managing DNS, testing HTTP endpoints, auditing security, working with containers, writing shell scripts, or asks 'what tool should I use for X'. Source: github.com/trimstray/the-book-of-secret-knowledge
Deploy applications and manage projects with complete CLI reference. Commands for deployments, projects, domains, environment variables, and live documentation access.
Monitor topics of interest and proactively alert when important developments occur. Use when user wants automated monitoring of specific subjects (e.g., product releases, price changes, news topics, technology updates). Supports scheduled web searches, AI-powered importance scoring, smart alerts vs weekly digests, and memory-aware contextual summaries.