feat: 全面SSH中转代理 + mimo-v2.5-pro支持

- Yahoo Finance: 跳过本地限流,直接走SSH中转
- StockTwits: 直连403时自动fallback到SSH中转
- Reddit: 网络不可达时自动fallback到SSH中转
- Polymarket: 网络不可达时自动fallback到SSH中转
- FRED: 配置API Key (825283926dd016ea66e96cc919e047da)
- .env: 新增FRED_API_KEY和OPENAI_COMPATIBLE_API_KEY
- test_xiaomi.py: 小米mimo-v2.5-pro测试脚本
This commit is contained in:
小钰 committed 2026-07-08 11:26:03 +08:00
1 parent 51d057e2c9
commit f8a47cb473
6 files changed
+93 -49

No files matched your search

+9 -13
View File
@@ -36,19 +36,15 @@ def get_YFin_data_online(
# end_date row (and the current day when end_date is today). Request one day
# past end_date so the requested range is actually inclusive (#986/#987).
end_inclusive = (end_dt + relativedelta(days=1)).strftime("%Y-%m-%d")
try:
data = yf_retry(lambda: ticker.history(start=start_date, end=end_inclusive))
except Exception:
# Fallback: use SSH proxy via foreign server
logger.warning(f"Yahoo Finance local failed for {symbol}, trying SSH proxy...")
proxy_df = _yf_download_via_proxy(canonical, start_date, end_inclusive)
if proxy_df.empty:
raise NoMarketDataError(
symbol, canonical, f"no rows between {start_date} and {end_date} (proxy also failed)"
)
# Convert to match expected format
proxy_df = proxy_df.set_index("Date")
data = proxy_df
# Skip local Yahoo Finance (rate-limited), go directly through SSH proxy
logger.info(f"Yahoo Finance: fetching {canonical} via SSH proxy...")
proxy_df = _yf_download_via_proxy(canonical, start_date, end_inclusive)
if proxy_df.empty:
raise NoMarketDataError(
symbol, canonical, f"no rows between {start_date} and {end_date} (proxy failed)"
)
proxy_df = proxy_df.set_index("Date")
data = proxy_df
# Empty result means the symbol is unknown/delisted. Raise a typed error
# instead of returning prose: the routing layer turns it into a single