feat: Yahoo Finance SSH proxy + Xiaomi MiMo LLM support
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

- 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/
This commit is contained in:
小钰 committed 2026-07-07 15:30:20 +08:00
1 parent 01477f9afb
commit 51d057e2c9
7 files changed
+824 -26

No files matched your search

+17 -1
View File
@@ -1,13 +1,17 @@
import logging
from datetime import datetime
from typing import Annotated
import pandas as pd
import yfinance as yf
logger = logging.getLogger(__name__)
from dateutil.relativedelta import relativedelta
from .stockstats_utils import (
StockstatsUtils,
_assert_ohlcv_not_stale,
_yf_download_via_proxy,
filter_financials_by_date,
load_ohlcv,
yf_retry,
@@ -32,7 +36,19 @@ 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")
data = yf_retry(lambda: ticker.history(start=start_date, end=end_inclusive))
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
# Empty result means the symbol is unknown/delisted. Raise a typed error
# instead of returning prose: the routing layer turns it into a single