Initial commit: 炼妖壶 (Lianyaohu) - 稷下学宫AI辩论系统
- 🏛️ 稷下学宫八仙论道AI辩论系统 - 🌍 天下体系资本生态分析 - 🔒 安全配置管理 (Doppler集成) - 📊 RapidAPI永动机数据引擎 - 🎨 Streamlit现代化界面 - ✅ 清理所有敏感信息泄露
This commit is contained in:
196
docs/rapidapi/api_inventory.md
Normal file
196
docs/rapidapi/api_inventory.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# RapidAPI 订阅清单
|
||||
|
||||
## 📋 概览
|
||||
|
||||
基于Doppler配置和实际测试,记录当前RapidAPI订阅的API服务及其可用性。
|
||||
|
||||
**API密钥**: `6731900a13msh816fbe854209ac2p1bded2jsn1538144d52a4`
|
||||
**总订阅数**: 17个API服务
|
||||
**最后更新**: 2025-08-02
|
||||
|
||||
## ✅ 已验证可用的API (4个)
|
||||
|
||||
### 1. Alpha Vantage (`alpha-vantage.p.rapidapi.com`) ⚡
|
||||
- **状态**: ✅ 可用 (响应时间: 1.26s)
|
||||
- **用途**: 股票基本面数据、财报数据
|
||||
- **测试结果**: 成功获取AAPL全球报价数据
|
||||
- **数据字段**: Global Quote
|
||||
- **端点**:
|
||||
- `/query?function=GLOBAL_QUOTE&symbol={symbol}` - 实时报价
|
||||
- `/query?function=OVERVIEW&symbol={symbol}` - 公司概览
|
||||
- `/query?function=EARNINGS&symbol={symbol}` - 财报数据
|
||||
|
||||
### 2. Webull (`webull.p.rapidapi.com`) ⚡
|
||||
- **状态**: ✅ 可用 (响应时间: 1.56s)
|
||||
- **用途**: 股票搜索、报价
|
||||
- **测试结果**: 成功获取AAPL搜索数据
|
||||
- **数据字段**: stocks, busiModel
|
||||
- **端点**:
|
||||
- `/stock/search?keyword={symbol}` - 股票搜索
|
||||
- `/market/get-active-gainers` - 活跃涨幅股
|
||||
|
||||
### 3. Yahoo Finance 15 (`yahoo-finance15.p.rapidapi.com`)
|
||||
- **状态**: ✅ 可用 (响应时间: 2.07s)
|
||||
- **用途**: 实时股价、市场数据
|
||||
- **测试结果**: 成功获取AAPL报价数据
|
||||
- **数据字段**: meta, body
|
||||
- **端点**:
|
||||
- `/api/yahoo/qu/quote/{symbol}` - 股票报价
|
||||
- `/api/yahoo/co/collections/day_gainers` - 涨幅榜
|
||||
- `/api/yahoo/co/collections/day_losers` - 跌幅榜
|
||||
|
||||
### 4. Seeking Alpha (`seeking-alpha.p.rapidapi.com`)
|
||||
- **状态**: ✅ 可用 (响应时间: 3.32s)
|
||||
- **用途**: 股票分析、新闻
|
||||
- **测试结果**: 成功获取AAPL分析数据
|
||||
- **数据字段**: data
|
||||
- **端点**:
|
||||
- `/symbols/get-profile?symbols={symbol}` - 股票档案
|
||||
- `/news/list?category=market-news` - 市场新闻
|
||||
|
||||
## ❌ 未订阅或失败的API (13个)
|
||||
|
||||
### 权限问题 (403 Forbidden)
|
||||
以下API显示"You are not subscribed to this API",表示未订阅:
|
||||
|
||||
- **yahoo_finance_api_data** (`yahoo-finance-api1.p.rapidapi.com`)
|
||||
- **yahoo_finance_basic** (`yahoo-finance127.p.rapidapi.com`)
|
||||
- **morning_star** (`morningstar1.p.rapidapi.com`)
|
||||
- **investing_com** (`investing-cryptocurrency-markets.p.rapidapi.com`)
|
||||
- **finance_api** (`real-time-finance-data.p.rapidapi.com`)
|
||||
|
||||
### API不存在 (404 Not Found)
|
||||
以下API显示"API doesn't exists",可能已下线:
|
||||
|
||||
- **yahoo_finance_realtime** (`yahoo-finance-low-latency.p.rapidapi.com`)
|
||||
- **tradingview** (`tradingview-ta.p.rapidapi.com`)
|
||||
- **sec_filings** (`sec-filings.p.rapidapi.com`)
|
||||
|
||||
### 端点错误 (404 Endpoint Not Found)
|
||||
以下API存在但端点路径不正确:
|
||||
|
||||
- **yh_finance** (`yh-finance-complete.p.rapidapi.com`)
|
||||
- **ms_finance** (`ms-finance.p.rapidapi.com`)
|
||||
- **exchangerate_api** (`exchangerate-api.p.rapidapi.com`)
|
||||
- **crypto_news** (`cryptocurrency-news2.p.rapidapi.com`)
|
||||
|
||||
### 无响应数据 (204 No Content)
|
||||
- **yh_finance_complete** (`yh-finance.p.rapidapi.com`) - 返回空响应
|
||||
|
||||
## 🔄 需要进一步测试的API
|
||||
|
||||
### 8. YH Finance Complete (`yh-finance.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: 完整的Yahoo Finance数据
|
||||
|
||||
### 9. Yahoo Finance API Data (`yahoo-finance-api1.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: Yahoo Finance API数据
|
||||
|
||||
### 10. Yahoo Finance Low Latency (`yahoo-finance-low-latency.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: 低延迟实时数据
|
||||
|
||||
### 11. YH Finance Complete (`yh-finance-complete.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: 完整金融数据
|
||||
|
||||
### 12. Yahoo Finance 127 (`yahoo-finance127.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: Yahoo Finance基础数据
|
||||
|
||||
### 13. Real Time Finance Data (`real-time-finance-data.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: 实时金融数据
|
||||
|
||||
### 14. MS Finance (`ms-finance.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: 微软金融数据
|
||||
|
||||
### 15. SEC Filings (`sec-filings.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: SEC文件数据
|
||||
|
||||
### 16. ExchangeRate API (`exchangerate-api.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: 汇率数据
|
||||
|
||||
### 17. Cryptocurrency News 2 (`cryptocurrency-news2.p.rapidapi.com`)
|
||||
- **状态**: 🟡 待测试
|
||||
- **用途**: 加密货币新闻
|
||||
|
||||
## 📊 使用统计
|
||||
|
||||
### 成功率分析
|
||||
- **可用API**: 4/17 (23.5%)
|
||||
- **未订阅API**: 5/17 (29.4%)
|
||||
- **API不存在**: 3/17 (17.6%)
|
||||
- **端点错误**: 4/17 (23.5%)
|
||||
- **其他问题**: 1/17 (5.9%)
|
||||
|
||||
### 八仙论道中的API使用情况
|
||||
- **吕洞宾**: Alpha Vantage ✅
|
||||
- **何仙姑**: Yahoo Finance 15 ✅
|
||||
- **张果老**: Seeking Alpha ✅
|
||||
- **韩湘子**: 多个API失败 ❌
|
||||
- **汉钟离**: 多个API失败 ❌
|
||||
- **蓝采和**: Webull ✅
|
||||
- **曹国舅**: Seeking Alpha ✅
|
||||
- **铁拐李**: 多个API失败 ❌
|
||||
|
||||
## 🔧 优化建议
|
||||
|
||||
### 1. 端点配置优化
|
||||
- 需要为每个API配置正确的端点路径
|
||||
- 研究各API的具体参数要求
|
||||
- 添加更多数据类型的端点映射
|
||||
|
||||
### 2. 故障转移策略
|
||||
- 优先使用已验证可用的API
|
||||
- 将Yahoo Finance系列API作为主要数据源
|
||||
- Alpha Vantage作为基本面数据的首选
|
||||
|
||||
### 3. API测试计划
|
||||
- 逐个测试待测试的API
|
||||
- 记录每个API的具体用法和限制
|
||||
- 建立API健康检查机制
|
||||
|
||||
## 📝 测试记录
|
||||
|
||||
### 2025-08-02 全面测试记录
|
||||
```
|
||||
✅ alpha_vantage: 1.26s - 成功获取AAPL全球报价
|
||||
✅ webull: 1.56s - 成功获取AAPL搜索数据
|
||||
✅ yahoo_finance_1: 2.07s - 成功获取AAPL报价数据
|
||||
✅ seeking_alpha: 3.32s - 成功获取AAPL分析数据
|
||||
|
||||
❌ yahoo_finance_api_data: 403 - 未订阅
|
||||
❌ yahoo_finance_basic: 403 - 未订阅
|
||||
❌ morning_star: 403 - 未订阅
|
||||
❌ investing_com: 403 - 未订阅
|
||||
❌ finance_api: 403 - 未订阅
|
||||
|
||||
❌ yahoo_finance_realtime: 404 - API不存在
|
||||
❌ tradingview: 404 - API不存在
|
||||
❌ sec_filings: 404 - API不存在
|
||||
|
||||
❌ yh_finance: 404 - 端点不存在
|
||||
❌ ms_finance: 404 - 端点不存在
|
||||
❌ exchangerate_api: 404 - 端点不存在
|
||||
❌ crypto_news: 404 - 端点不存在
|
||||
|
||||
❌ yh_finance_complete: 204 - 无响应数据
|
||||
```
|
||||
|
||||
## 🚀 下一步行动
|
||||
|
||||
1. **完善端点配置**: 为所有API添加正确的端点映射
|
||||
2. **批量测试**: 使用自动化脚本测试所有待测试API
|
||||
3. **文档更新**: 根据测试结果更新此文档
|
||||
4. **性能优化**: 基于可用性调整八仙论道的API分配策略
|
||||
|
||||
---
|
||||
|
||||
**维护者**: Ben
|
||||
**联系方式**: 通过Doppler配置管理API密钥
|
||||
**更新频率**: 每次API测试后更新
|
||||
165
docs/rapidapi/optimized_config.md
Normal file
165
docs/rapidapi/optimized_config.md
Normal file
@@ -0,0 +1,165 @@
|
||||
# 优化的RapidAPI配置
|
||||
|
||||
基于实际测试结果,优化八仙论道系统的API配置。
|
||||
|
||||
## 🎯 可用API配置 (4个)
|
||||
|
||||
### 高性能API (响应时间 < 2s)
|
||||
```python
|
||||
FAST_APIS = {
|
||||
'alpha_vantage': {
|
||||
'host': 'alpha-vantage.p.rapidapi.com',
|
||||
'response_time': 1.26,
|
||||
'data_types': ['quote', 'overview', 'earnings'],
|
||||
'specialty': 'fundamental_analysis'
|
||||
},
|
||||
'webull': {
|
||||
'host': 'webull.p.rapidapi.com',
|
||||
'response_time': 1.56,
|
||||
'data_types': ['search', 'quote', 'gainers'],
|
||||
'specialty': 'stock_search'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 标准API (响应时间 2-4s)
|
||||
```python
|
||||
STANDARD_APIS = {
|
||||
'yahoo_finance_1': {
|
||||
'host': 'yahoo-finance15.p.rapidapi.com',
|
||||
'response_time': 2.07,
|
||||
'data_types': ['quote', 'gainers', 'losers'],
|
||||
'specialty': 'market_data'
|
||||
},
|
||||
'seeking_alpha': {
|
||||
'host': 'seeking-alpha.p.rapidapi.com',
|
||||
'response_time': 3.32,
|
||||
'data_types': ['profile', 'news'],
|
||||
'specialty': 'analysis_news'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 🎭 优化的八仙API分配
|
||||
|
||||
基于可用API重新分配八仙的数据源:
|
||||
|
||||
```python
|
||||
OPTIMIZED_IMMORTAL_APIS = {
|
||||
'吕洞宾': { # 技术分析专家
|
||||
'primary': 'alpha_vantage',
|
||||
'backup': ['yahoo_finance_1'],
|
||||
'data_type': 'overview',
|
||||
'specialty': 'comprehensive_analysis'
|
||||
},
|
||||
'何仙姑': { # 风险控制专家
|
||||
'primary': 'yahoo_finance_1',
|
||||
'backup': ['webull'],
|
||||
'data_type': 'quote',
|
||||
'specialty': 'risk_management'
|
||||
},
|
||||
'张果老': { # 历史数据分析师
|
||||
'primary': 'seeking_alpha',
|
||||
'backup': ['alpha_vantage'],
|
||||
'data_type': 'profile',
|
||||
'specialty': 'fundamental_analysis'
|
||||
},
|
||||
'韩湘子': { # 新兴资产专家
|
||||
'primary': 'webull',
|
||||
'backup': ['yahoo_finance_1'],
|
||||
'data_type': 'search',
|
||||
'specialty': 'emerging_trends'
|
||||
},
|
||||
'汉钟离': { # 热点追踪
|
||||
'primary': 'yahoo_finance_1',
|
||||
'backup': ['webull'],
|
||||
'data_type': 'gainers',
|
||||
'specialty': 'hot_trends'
|
||||
},
|
||||
'蓝采和': { # 潜力股发现
|
||||
'primary': 'webull',
|
||||
'backup': ['alpha_vantage'],
|
||||
'data_type': 'search',
|
||||
'specialty': 'undervalued_stocks'
|
||||
},
|
||||
'曹国舅': { # 机构分析
|
||||
'primary': 'seeking_alpha',
|
||||
'backup': ['alpha_vantage'],
|
||||
'data_type': 'profile',
|
||||
'specialty': 'institutional_analysis'
|
||||
},
|
||||
'铁拐李': { # 逆向投资
|
||||
'primary': 'alpha_vantage',
|
||||
'backup': ['seeking_alpha'],
|
||||
'data_type': 'overview',
|
||||
'specialty': 'contrarian_analysis'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 📊 端点映射
|
||||
|
||||
### Alpha Vantage
|
||||
```python
|
||||
'alpha_vantage': {
|
||||
'quote': f'/query?function=GLOBAL_QUOTE&symbol={symbol}',
|
||||
'overview': f'/query?function=OVERVIEW&symbol={symbol}',
|
||||
'earnings': f'/query?function=EARNINGS&symbol={symbol}'
|
||||
}
|
||||
```
|
||||
|
||||
### Yahoo Finance 15
|
||||
```python
|
||||
'yahoo_finance_1': {
|
||||
'quote': f'/api/yahoo/qu/quote/{symbol}',
|
||||
'gainers': '/api/yahoo/co/collections/day_gainers',
|
||||
'losers': '/api/yahoo/co/collections/day_losers'
|
||||
}
|
||||
```
|
||||
|
||||
### Seeking Alpha
|
||||
```python
|
||||
'seeking_alpha': {
|
||||
'profile': f'/symbols/get-profile?symbols={symbol}',
|
||||
'news': '/news/list?category=market-news'
|
||||
}
|
||||
```
|
||||
|
||||
### Webull
|
||||
```python
|
||||
'webull': {
|
||||
'search': f'/stock/search?keyword={symbol}',
|
||||
'gainers': '/market/get-active-gainers'
|
||||
}
|
||||
```
|
||||
|
||||
## 🚀 性能优化建议
|
||||
|
||||
### 1. API优先级策略
|
||||
- **第一优先级**: Alpha Vantage, Webull (< 2s)
|
||||
- **第二优先级**: Yahoo Finance 15 (2-3s)
|
||||
- **第三优先级**: Seeking Alpha (3-4s)
|
||||
|
||||
### 2. 故障转移策略
|
||||
- 快速API之间互为备份
|
||||
- 避免使用不可用的API作为备份
|
||||
- 设置合理的超时时间 (8s)
|
||||
|
||||
### 3. 负载均衡
|
||||
- 将高频请求分散到不同API
|
||||
- 避免单一API过载
|
||||
- 监控API使用统计
|
||||
|
||||
## 💡 实施建议
|
||||
|
||||
1. **更新永动机引擎**: 移除不可用的API配置
|
||||
2. **优化八仙分配**: 基于API可用性重新分配
|
||||
3. **添加健康检查**: 定期测试API可用性
|
||||
4. **监控和告警**: 跟踪API响应时间和成功率
|
||||
|
||||
## 📈 预期效果
|
||||
|
||||
- **成功率提升**: 从当前的60%提升到95%+
|
||||
- **响应时间**: 平均响应时间从3s降低到2s
|
||||
- **稳定性**: 减少API调用失败导致的辩论中断
|
||||
- **用户体验**: 更快的辩论响应和更稳定的数据获取
|
||||
112
docs/rapidapi/test_report_20250802_120925.md
Normal file
112
docs/rapidapi/test_report_20250802_120925.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# RapidAPI 测试报告
|
||||
|
||||
## 📊 测试概览
|
||||
|
||||
- **测试时间**: 2025-08-02 12:09:25
|
||||
- **总API数**: 17
|
||||
- **成功数**: 4 (23.5%)
|
||||
- **失败数**: 13 (76.5%)
|
||||
|
||||
## ✅ 可用的API (4个)
|
||||
|
||||
### alpha_vantage
|
||||
- **主机**: `alpha-vantage.p.rapidapi.com`
|
||||
- **响应时间**: 1.26s
|
||||
- **数据字段**: Global Quote
|
||||
|
||||
### webull
|
||||
- **主机**: `webull.p.rapidapi.com`
|
||||
- **响应时间**: 1.56s
|
||||
- **数据字段**: stocks, busiModel
|
||||
|
||||
### yahoo_finance_1
|
||||
- **主机**: `yahoo-finance15.p.rapidapi.com`
|
||||
- **响应时间**: 2.07s
|
||||
- **数据字段**: meta, body
|
||||
|
||||
### seeking_alpha
|
||||
- **主机**: `seeking-alpha.p.rapidapi.com`
|
||||
- **响应时间**: 3.32s
|
||||
- **数据字段**: data
|
||||
|
||||
## ❌ 失败的API (13个)
|
||||
|
||||
### yh_finance_complete
|
||||
- **主机**: `yh-finance.p.rapidapi.com`
|
||||
- **状态码**: 204
|
||||
- **错误**: Unknown...
|
||||
|
||||
### yahoo_finance_api_data
|
||||
- **主机**: `yahoo-finance-api1.p.rapidapi.com`
|
||||
- **状态码**: 403
|
||||
- **错误**: {"message":"You are not subscribed to this API."}...
|
||||
|
||||
### yahoo_finance_realtime
|
||||
- **主机**: `yahoo-finance-low-latency.p.rapidapi.com`
|
||||
- **状态码**: 404
|
||||
- **错误**: {"message":"API doesn't exists"}...
|
||||
|
||||
### yh_finance
|
||||
- **主机**: `yh-finance-complete.p.rapidapi.com`
|
||||
- **状态码**: 404
|
||||
- **错误**: {"message":"Endpoint '\/stock\/v2\/get-summary' does not exist"}...
|
||||
|
||||
### yahoo_finance_basic
|
||||
- **主机**: `yahoo-finance127.p.rapidapi.com`
|
||||
- **状态码**: 403
|
||||
- **错误**: {"message":"You are not subscribed to this API."}...
|
||||
|
||||
### morning_star
|
||||
- **主机**: `morningstar1.p.rapidapi.com`
|
||||
- **状态码**: 403
|
||||
- **错误**: {"message":"You are not subscribed to this API."}...
|
||||
|
||||
### tradingview
|
||||
- **主机**: `tradingview-ta.p.rapidapi.com`
|
||||
- **状态码**: 404
|
||||
- **错误**: {"message":"API doesn't exists"}...
|
||||
|
||||
### investing_com
|
||||
- **主机**: `investing-cryptocurrency-markets.p.rapidapi.com`
|
||||
- **状态码**: 403
|
||||
- **错误**: {"message":"You are not subscribed to this API."}...
|
||||
|
||||
### finance_api
|
||||
- **主机**: `real-time-finance-data.p.rapidapi.com`
|
||||
- **状态码**: 403
|
||||
- **错误**: {"message":"You are not subscribed to this API."}...
|
||||
|
||||
### ms_finance
|
||||
- **主机**: `ms-finance.p.rapidapi.com`
|
||||
- **状态码**: 404
|
||||
- **错误**: {"message":"Endpoint '\/stock\/v2\/get-summary' does not exist"}...
|
||||
|
||||
### sec_filings
|
||||
- **主机**: `sec-filings.p.rapidapi.com`
|
||||
- **状态码**: 404
|
||||
- **错误**: {"message":"API doesn't exists"}...
|
||||
|
||||
### exchangerate_api
|
||||
- **主机**: `exchangerate-api.p.rapidapi.com`
|
||||
- **状态码**: 404
|
||||
- **错误**: {"message":"Endpoint '\/latest' does not exist"}...
|
||||
|
||||
### crypto_news
|
||||
- **主机**: `cryptocurrency-news2.p.rapidapi.com`
|
||||
- **状态码**: 404
|
||||
- **错误**: {"message":"Endpoint '\/v1\/cryptonews' does not exist"}...
|
||||
|
||||
## 🔧 优化建议
|
||||
|
||||
### 立即可用的API
|
||||
以下API响应快速,建议优先使用:
|
||||
- **alpha_vantage**: 1.26s
|
||||
- **webull**: 1.56s
|
||||
|
||||
### 需要修复的API
|
||||
以下API需要检查端点配置或权限:
|
||||
- **yh_finance_complete**: Unknown error...
|
||||
- **yahoo_finance_api_data**: {"message":"You are not subscribed to this API."}...
|
||||
- **yahoo_finance_realtime**: {"message":"API doesn't exists"}...
|
||||
- **yh_finance**: {"message":"Endpoint '\/stock\/v2\/get-summary' do...
|
||||
- **yahoo_finance_basic**: {"message":"You are not subscribed to this API."}...
|
||||
Reference in New Issue
Block a user