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
@@ -24,7 +24,10 @@ logger = logging.getLogger(__name__)
|
||||
GAMMA_BASE = "https://gamma-api.polymarket.com"
|
||||
|
||||
# Network timeout (seconds), consistent with the other vendors.
|
||||
REQUEST_TIMEOUT = 30
|
||||
REQUEST_TIMEOUT = 15
|
||||
|
||||
# Timeout for direct Polymarket API call (fail fast, use SSH proxy)
|
||||
DIRECT_TIMEOUT = 5
|
||||
|
||||
# Default number of markets to return, ranked by traded volume.
|
||||
DEFAULT_LIMIT = 6
|
||||
@@ -33,7 +36,7 @@ DEFAULT_LIMIT = 6
|
||||
def _request(path: str, params: dict) -> dict:
|
||||
url = f"{GAMMA_BASE}/{path}"
|
||||
try:
|
||||
response = requests.get(url, params=params, timeout=REQUEST_TIMEOUT)
|
||||
response = requests.get(url, params=params, timeout=DIRECT_TIMEOUT)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.RequestException:
|
||||
|
||||
Reference in new issue
Block a user