fix: 优化Yahoo Finance跳过策略 + Polymarket超时
- yf_retry: 直接抛出YFRateLimitError,跳过本地重试 - Polymarket: 直连超时从30s降到5s,快速fallback到SSH - 基础数据(yf_retry调用)将优雅降级,不阻塞分析流程
This commit is contained in:
1 parent
f8a47cb473
commit
6bba181307
2 files changed
+7
-13
No files matched your search
@@ -105,17 +105,8 @@ def yf_retry(func, max_retries=3, base_delay=2.0):
|
||||
retry them internally. This wrapper adds retry logic specifically
|
||||
for rate limits. Other exceptions propagate immediately.
|
||||
"""
|
||||
for attempt in range(max_retries + 1):
|
||||
try:
|
||||
return func()
|
||||
except YFRateLimitError:
|
||||
if attempt < max_retries:
|
||||
delay = base_delay * (2 ** attempt)
|
||||
logger.warning(f"Yahoo Finance rate limited, retrying in {delay:.0f}s (attempt {attempt + 1}/{max_retries})")
|
||||
time.sleep(delay)
|
||||
else:
|
||||
logger.warning("Yahoo Finance local exhausted, will let caller handle fallback")
|
||||
raise
|
||||
# Skip local Yahoo Finance entirely - always use SSH proxy
|
||||
raise YFRateLimitError("Local Yahoo Finance disabled, use SSH proxy")
|
||||
|
||||
|
||||
def _ensure_date_column(data: pd.DataFrame) -> pd.DataFrame:
|
||||
|
||||
Reference in new issue
Block a user