TradingAgents/tradingagents/dataflows/discovery
Youssef Aitousarrah ce2a6ef8fa fix(discovery): fix infinite hang when a scanner thread blocks indefinitely
Two issues caused the agent to get stuck after the last log message
from a completed scanner (e.g. "✓ reddit_trending: 11 candidates"):

1. `as_completed()` had no global timeout. If a scanner thread blocked
   in a non-interruptible I/O call, `as_completed()` waited forever
   because it only yields a future once it has finished — the per-future
   `future.result(timeout=N)` call was never even reached.
   Fixed by passing `timeout=global_timeout` to `as_completed()` so
   the outer iterator raises TimeoutError after a capped wall-clock
   budget, then logs which scanners didn't complete and continues.

2. `SectorRotationScanner` called `get_ticker_info()` (one HTTP request
   per ticker) in a serial loop for up to 100 tickers from a 592-ticker
   file, easily exceeding the 30 s per-scanner budget.
   Fixed by batch-downloading close prices for all tickers in a single
   `download_history()` call, computing 5-day returns locally, and only
   calling `get_ticker_info()` for the small subset of laggard tickers
   (<2% 5d move) that actually need a sector label.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 22:14:53 -08:00
..
performance feat: discovery pipeline enhancements with ML signal scanner 2026-02-09 22:53:42 -08:00
scanners fix(discovery): fix infinite hang when a scanner thread blocks indefinitely 2026-02-20 22:14:53 -08:00
__init__.py feat: discovery system code quality improvements and concurrent execution 2026-02-05 23:27:01 -08:00
analytics.py Update 2026-02-20 08:38:15 -08:00
candidate.py feat: discovery system code quality improvements and concurrent execution 2026-02-05 23:27:01 -08:00
common_utils.py feat: discovery pipeline enhancements with ML signal scanner 2026-02-09 22:53:42 -08:00
discovery_config.py Update 2026-02-20 08:38:15 -08:00
filter.py Update 2026-02-20 08:38:15 -08:00
ranker.py Update 2026-02-20 08:38:15 -08:00
scanner_registry.py Update 2026-02-20 08:38:15 -08:00
ticker_matcher.py feat: discovery pipeline enhancements with ML signal scanner 2026-02-09 22:53:42 -08:00
utils.py feat: improve all 9 scanners and add 3 new scanners 2026-02-20 08:36:18 -08:00