diff --git a/tradingagents/dataflows/polymarket.py b/tradingagents/dataflows/polymarket.py index a6e52d0..97637cf 100644 --- a/tradingagents/dataflows/polymarket.py +++ b/tradingagents/dataflows/polymarket.py @@ -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: diff --git a/tradingagents/dataflows/stockstats_utils.py b/tradingagents/dataflows/stockstats_utils.py index 48e4a19..681ddef 100644 --- a/tradingagents/dataflows/stockstats_utils.py +++ b/tradingagents/dataflows/stockstats_utils.py @@ -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: