From 957b009da13c81f0151d0f5b335b510a27e649b9 Mon Sep 17 00:00:00 2001 From: Youssef Aitousarrah Date: Mon, 6 Apr 2026 14:24:21 -0700 Subject: [PATCH] fix(minervini): cap ticker universe to prevent CI timeout yf.download(592 tickers, period=1y) takes 20+ minutes in CI, causing the 30-minute job timeout to trigger. Add max_tickers=200 (configurable) to limit the batch download to the first N tickers from the file. The concurrent scanner pool already has a 5-min global timeout, but the hung download thread monopolises network connections and starves the filter stage. Co-Authored-By: Claude Sonnet 4.6 --- tradingagents/dataflows/discovery/scanners/minervini.py | 5 +++++ tradingagents/default_config.py | 1 + 2 files changed, 6 insertions(+) diff --git a/tradingagents/dataflows/discovery/scanners/minervini.py b/tradingagents/dataflows/discovery/scanners/minervini.py index d0e2e369..cb1e1744 100644 --- a/tradingagents/dataflows/discovery/scanners/minervini.py +++ b/tradingagents/dataflows/discovery/scanners/minervini.py @@ -65,6 +65,7 @@ class MinerviniScanner(BaseScanner): self.sma_200_slope_days = self.scanner_config.get("sma_200_slope_days", 20) self.min_pct_off_low = self.scanner_config.get("min_pct_off_low", 30) self.max_pct_from_high = self.scanner_config.get("max_pct_from_high", 25) + self.max_tickers = self.scanner_config.get("max_tickers", 200) def scan(self, state: Dict[str, Any]) -> List[Dict[str, Any]]: if not self.is_enabled(): @@ -77,6 +78,10 @@ class MinerviniScanner(BaseScanner): logger.warning("No tickers loaded for Minervini scan") return [] + if self.max_tickers and len(tickers) > self.max_tickers: + logger.info(f"Limiting Minervini scan to {self.max_tickers}/{len(tickers)} tickers") + tickers = tickers[: self.max_tickers] + # Batch download OHLCV — 1y needed for SMA200 import yfinance as yf diff --git a/tradingagents/default_config.py b/tradingagents/default_config.py index 81197081..1b3878ed 100644 --- a/tradingagents/default_config.py +++ b/tradingagents/default_config.py @@ -229,6 +229,7 @@ DEFAULT_CONFIG = { "sma_200_slope_days": 20, # Days back to check SMA200 slope "min_pct_off_low": 30, # Must be 30%+ above 52w low "max_pct_from_high": 25, # Must be within 25% of 52w high + "max_tickers": 200, # Cap universe to keep download under scanner timeout }, }, },