开源A股量化分析(并且配合llm模型,进行高级分析)
See the code这是一个比较专业的AI增强 A股股票分析系统,集成了25项财务指标分析、综合新闻情绪分析、技术指标计算和AI深度解读。系统支持多种AI模型(OpenAI GPT、Claude、智谱AI),提供桌面GUI和Web两种界面,具备实时流式推送功能。 暂时只支持中国股票,港美股正在优化还未发布,港美股新闻信息等获取受限缓慢优化中。
如果这个项目对您有帮助,欢迎支持: 🔗 https://juanzen.linzefeng.top/
📦 AI股票分析系统
├── 🖥️ 桌面版 (2.0 win app/)
│ ├── gui2.py # 现代化GUI界面
│ ├── stock_analyzer.py # 核心分析引擎
│ ├── 配置文件编辑器.py # 可视化配置管理
│ └── config.json # 系统配置文件
├── 🌐 Web版 (2.6 webapp/)
│ ├── flask_web_server.py # Flask服务器(SSE支持)
│ ├── web_stock_analyzer.py # Web优化分析器
│ ├── Dockerfile # Docker容器配置
│ └── docker-compose.yaml # 容器编排配置
└── 📚 文档
└── README.md # 项目文档
# 克隆项目
git clone https://github.com/DR-lin-eng/stock-scanner.git
cd stock-analysis-system
# 安装依赖
pip install -r requirements.txt
创建 config.json 文件(参考 config - 示例.json):
{
"api_keys": {
"openai": "sk-your-openai-key",
"anthropic": "sk-ant-your-claude-key",
"zhipu": "your-zhipu-key"
},
"ai": {
"model_preference": "openai",
"models": {
"openai": "gpt-4o-mini",
"anthropic": "claude-3-haiku-20240307"
}
},
"web_auth": {
"enabled": true,
"password": "your_password",
"session_timeout": 3600
}
}
cd "2.0 win app"
python gui2.py
cd "2.6 webapp(流式传输测试版)"
python flask_web_server.py
# 访问 http://localhost:5000
cd "2.6 webapp(流式传输测试版)"
docker-compose up -d
| 类别 | 指标 | 说明 |
|---|---|---|
| 盈利能力 | 净利润率、净资产收益率、总资产收益率 | 评估公司盈利水平 |
| 偿债能力 | 流动比率、资产负债率、利息保障倍数 | 评估财务风险 |
| 营运能力 | 总资产周转率、存货周转率 | 评估运营效率 |
| 发展能力 | 营收增长率、净利润增长率 | 评估成长性 |
| 市场表现 | 市盈率、市净率、PEG比率 | 评估估值水平 |
| 接口 | 方法 | 说明 |
|---|---|---|
/api/status | GET | 系统状态检查 |
/api/sse | GET | SSE流式接口 |
/api/analyze_stream | POST | 单股票流式分析 |
/api/batch_analyze_stream | POST | 批量流式分析 |
/api/system_info | GET | 系统信息 |
connected: 连接确认log: 日志消息progress: 进度更新scores_update: 评分更新final_result: 最终结果ai_stream: AI流式内容{
"analysis_weights": {
"technical": 0.4, // 技术面权重
"fundamental": 0.4, // 基本面权重
"sentiment": 0.2 // 情绪面权重
},
"analysis_params": {
"max_news_count": 100, // 最大新闻数量
"technical_period_days": 365, // 技术分析周期
"financial_indicators_count": 25 // 财务指标数量
},
"cache": {
"price_hours": 1, // 价格数据缓存时间
"fundamental_hours": 6, // 基本面缓存时间
"news_hours": 2 // 新闻数据缓存时间
}
}
from stock_analyzer import EnhancedStockAnalyzer
# 初始化分析器
analyzer = EnhancedStockAnalyzer()
# 分析股票
report = analyzer.analyze_stock('000001')
print(f"股票名称: {report['stock_name']}")
print(f"综合得分: {report['scores']['comprehensive']:.1f}")
print(f"投资建议: {report['recommendation']}")
# 单股票分析
curl -X POST http://localhost:5000/api/analyze_stream \
-H "Content-Type: application/json" \
-d '{"stock_code": "000001", "client_id": "test_client"}'
# 批量分析
curl -X POST http://localhost:5000/api/batch_analyze_stream \
-H "Content-Type: application/json" \
-d '{"stock_codes": ["000001", "000002"], "client_id": "test_client"}'
数据获取失败
# 检查网络连接
ping quote.eastmoney.com
# 检查akshare版本
pip install --upgrade akshare
AI分析失败
# 检查API密钥配置
python -c "import json; print(json.load(open('config.json'))['api_keys'])"
# 测试API连接
curl -H "Authorization: Bearer YOUR_API_KEY" https://api.openai.com/v1/models
Web版访问问题
# 检查端口占用
netstat -tulpn | grep :5000
# 查看服务日志
python flask_web_server.py
# 安装开发依赖
pip install -r requirements.txt
# 启动开发服务器
python flask_web_server.py
# 使用Gunicorn部署
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 flask_web_server:app
# 或使用Docker
docker-compose up -d
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /api/sse {
proxy_pass http://localhost:5000;
proxy_set_header Connection '';
proxy_http_version 1.1;
proxy_buffering off;
proxy_cache off;
chunked_transfer_encoding off;
}
}
欢迎提交Issues和Pull Requests!
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)MIT License - 详见 LICENSE 文件
Copyright (c) 2024 [linzefeng]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
本系统仅用于学习和研究目的,所有分析结果仅供参考,不构成投资建议。投资有风险,入市需谨慎。
Pollinations AI 为提供llm生成服务
yxvm | NodeSupport 赞助了本项目
Created by [linzefeng]
开源A股量化分析(并且配合llm模型,进行高级分析)
See the code这是一个比较专业的AI增强 A股股票分析系统,集成了25项财务指标分析、综合新闻情绪分析、技术指标计算和AI深度解读。系统支持多种AI模型(OpenAI GPT、Claude、智谱AI),提供桌面GUI和Web两种界面,具备实时流式推送功能。 暂时只支持中国股票,港美股正在优化还未发布,港美股新闻信息等获取受限缓慢优化中。
如果这个项目对您有帮助,欢迎支持: 🔗 https://juanzen.linzefeng.top/
📦 AI股票分析系统
├── 🖥️ 桌面版 (2.0 win app/)
│ ├── gui2.py # 现代化GUI界面
│ ├── stock_analyzer.py # 核心分析引擎
│ ├── 配置文件编辑器.py # 可视化配置管理
│ └── config.json # 系统配置文件
├── 🌐 Web版 (2.6 webapp/)
│ ├── flask_web_server.py # Flask服务器(SSE支持)
│ ├── web_stock_analyzer.py # Web优化分析器
│ ├── Dockerfile # Docker容器配置
│ └── docker-compose.yaml # 容器编排配置
└── 📚 文档
└── README.md # 项目文档
# 克隆项目
git clone https://github.com/DR-lin-eng/stock-scanner.git
cd stock-analysis-system
# 安装依赖
pip install -r requirements.txt
创建 config.json 文件(参考 config - 示例.json):
{
"api_keys": {
"openai": "sk-your-openai-key",
"anthropic": "sk-ant-your-claude-key",
"zhipu": "your-zhipu-key"
},
"ai": {
"model_preference": "openai",
"models": {
"openai": "gpt-4o-mini",
"anthropic": "claude-3-haiku-20240307"
}
},
"web_auth": {
"enabled": true,
"password": "your_password",
"session_timeout": 3600
}
}
cd "2.0 win app"
python gui2.py
cd "2.6 webapp(流式传输测试版)"
python flask_web_server.py
# 访问 http://localhost:5000
cd "2.6 webapp(流式传输测试版)"
docker-compose up -d
| 类别 | 指标 | 说明 |
|---|---|---|
| 盈利能力 | 净利润率、净资产收益率、总资产收益率 | 评估公司盈利水平 |
| 偿债能力 | 流动比率、资产负债率、利息保障倍数 | 评估财务风险 |
| 营运能力 | 总资产周转率、存货周转率 | 评估运营效率 |
| 发展能力 | 营收增长率、净利润增长率 | 评估成长性 |
| 市场表现 | 市盈率、市净率、PEG比率 | 评估估值水平 |
| 接口 | 方法 | 说明 |
|---|---|---|
/api/status | GET | 系统状态检查 |
/api/sse | GET | SSE流式接口 |
/api/analyze_stream | POST | 单股票流式分析 |
/api/batch_analyze_stream | POST | 批量流式分析 |
/api/system_info | GET | 系统信息 |
connected: 连接确认log: 日志消息progress: 进度更新scores_update: 评分更新final_result: 最终结果ai_stream: AI流式内容{
"analysis_weights": {
"technical": 0.4, // 技术面权重
"fundamental": 0.4, // 基本面权重
"sentiment": 0.2 // 情绪面权重
},
"analysis_params": {
"max_news_count": 100, // 最大新闻数量
"technical_period_days": 365, // 技术分析周期
"financial_indicators_count": 25 // 财务指标数量
},
"cache": {
"price_hours": 1, // 价格数据缓存时间
"fundamental_hours": 6, // 基本面缓存时间
"news_hours": 2 // 新闻数据缓存时间
}
}
from stock_analyzer import EnhancedStockAnalyzer
# 初始化分析器
analyzer = EnhancedStockAnalyzer()
# 分析股票
report = analyzer.analyze_stock('000001')
print(f"股票名称: {report['stock_name']}")
print(f"综合得分: {report['scores']['comprehensive']:.1f}")
print(f"投资建议: {report['recommendation']}")
# 单股票分析
curl -X POST http://localhost:5000/api/analyze_stream \
-H "Content-Type: application/json" \
-d '{"stock_code": "000001", "client_id": "test_client"}'
# 批量分析
curl -X POST http://localhost:5000/api/batch_analyze_stream \
-H "Content-Type: application/json" \
-d '{"stock_codes": ["000001", "000002"], "client_id": "test_client"}'
数据获取失败
# 检查网络连接
ping quote.eastmoney.com
# 检查akshare版本
pip install --upgrade akshare
AI分析失败
# 检查API密钥配置
python -c "import json; print(json.load(open('config.json'))['api_keys'])"
# 测试API连接
curl -H "Authorization: Bearer YOUR_API_KEY" https://api.openai.com/v1/models
Web版访问问题
# 检查端口占用
netstat -tulpn | grep :5000
# 查看服务日志
python flask_web_server.py
# 安装开发依赖
pip install -r requirements.txt
# 启动开发服务器
python flask_web_server.py
# 使用Gunicorn部署
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 flask_web_server:app
# 或使用Docker
docker-compose up -d
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /api/sse {
proxy_pass http://localhost:5000;
proxy_set_header Connection '';
proxy_http_version 1.1;
proxy_buffering off;
proxy_cache off;
chunked_transfer_encoding off;
}
}
欢迎提交Issues和Pull Requests!
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)MIT License - 详见 LICENSE 文件
Copyright (c) 2024 [linzefeng]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
本系统仅用于学习和研究目的,所有分析结果仅供参考,不构成投资建议。投资有风险,入市需谨慎。
Pollinations AI 为提供llm生成服务
yxvm | NodeSupport 赞助了本项目
Created by [linzefeng]