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 <noreply@anthropic.com>
This commit is contained in:
parent
1f92269fcb
commit
957b009da1
|
|
@ -65,6 +65,7 @@ class MinerviniScanner(BaseScanner):
|
||||||
self.sma_200_slope_days = self.scanner_config.get("sma_200_slope_days", 20)
|
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.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_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]]:
|
def scan(self, state: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||||
if not self.is_enabled():
|
if not self.is_enabled():
|
||||||
|
|
@ -77,6 +78,10 @@ class MinerviniScanner(BaseScanner):
|
||||||
logger.warning("No tickers loaded for Minervini scan")
|
logger.warning("No tickers loaded for Minervini scan")
|
||||||
return []
|
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
|
# Batch download OHLCV — 1y needed for SMA200
|
||||||
import yfinance as yf
|
import yfinance as yf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,7 @@ DEFAULT_CONFIG = {
|
||||||
"sma_200_slope_days": 20, # Days back to check SMA200 slope
|
"sma_200_slope_days": 20, # Days back to check SMA200 slope
|
||||||
"min_pct_off_low": 30, # Must be 30%+ above 52w low
|
"min_pct_off_low": 30, # Must be 30%+ above 52w low
|
||||||
"max_pct_from_high": 25, # Must be within 25% of 52w high
|
"max_pct_from_high": 25, # Must be within 25% of 52w high
|
||||||
|
"max_tickers": 200, # Cap universe to keep download under scanner timeout
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue