Files
小钰 51d057e2c9
CI / tests (py3.10) (push) Has been cancelled
CI / tests (py3.11) (push) Has been cancelled
CI / tests (py3.12) (push) Has been cancelled
CI / tests (py3.13) (push) Has been cancelled
CI / clean-install smoke (push) Has been cancelled
CI / ruff (strict, full repo) (push) Has been cancelled
feat: Yahoo Finance SSH proxy + Xiaomi MiMo LLM support
- Add SSH proxy via foreign server for Yahoo Finance bypass
- Add fallback in load_ohlcv and get_YFin_data_online
- Add LLM JSON decode retry (3 attempts) in NormalizedChatOpenAI
- Add yahoo_proxy.py utility module
- Add test_smoke.py and patches/
2026-07-07 15:30:20 +08:00

53 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TradingAgents: Yahoo Finance SSH Proxy + Xiaomi MiMo LLM Support
## 概述
本 patch 解决两个核心问题:
1. **Yahoo Finance 云服务器 IP 被限流** — 通过国外服务器 SSH 代理中转请求
2. **LLM 兼容性** — 支持小米 MiMo 等 OpenAI 兼容接口,增加 JSON 解析重试
## 修改文件
| 文件 | 修改内容 |
|------|----------|
| `tradingagents/dataflows/yahoo_proxy.py` | **新增** — SSH 代理工具模块 |
| `tradingagents/dataflows/stockstats_utils.py` | Yahoo Finance 代理降级 + `_yf_download_via_proxy` |
| `tradingagents/dataflows/y_finance.py` | `get_YFin_data_online` 代理降级 |
| `tradingagents/llm_clients/openai_client.py` | LLM JSON 解析重试机制 |
## 应用方法
```bash
cd TradingAgents
git apply patches/yahoo-proxy-xiaomi-support.patch
```
## 前置条件
1. 国外服务器 SSH 凭据配置在 `secrets/credentials.env.enc`(变量 `FOREIGN_HOST`, `FOREIGN_PORT`, `FOREIGN_PASS`)
2. `sshpass` 已安装:`apt install sshpass`
3. Alpha Vantage API key(可选,用于基本面数据)
## 使用小米 MiMo 模型
```python
import os
os.environ["OPENAI_API_KEY"] = "your-xiaomi-api-key"
os.environ["OPENAI_API_BASE"] = "https://token-plan-cn.xiaomimimo.com/v1"
config = DEFAULT_CONFIG.copy()
config["llm_provider"] = "openai"
config["deep_think_llm"] = "mimo-v2.5-pro"
config["quick_think_llm"] = "mimo-v2.5"
```
## 测试结果
- ✅ Yahoo Finance SSH 代理:1137 行 OHLCV 数据获取成功
- ✅ 小米 MiMo Pro:完整分析流程通过(技术/基本面/情绪/新闻/辩论/决策)
- ✅ LLM JSON 重试:偶发解析错误自动恢复
- ✅ Alpha Vantage:基本面数据正常
---
*Generated: 2026-07-07 | Author: 小钰*