File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ concurrency:
2222jobs :
2323 scan :
2424 runs-on : ubuntu-latest
25- timeout-minutes : 15
25+ timeout-minutes : 30
2626
2727 # ── All secrets & config as env vars (job level) ──────────
2828 env :
9696
9797 # ── 6. Run the bot ──────────────────────────────────────
9898 - name : Run Tech Losers Scan
99- run : python main.py --no-wait --scan-source fmp-quotes
99+ run : python main.py --no-wait --scan-source td
100100
101101 # ── 7. Upload report artifacts (optional, for debugging) ─
102102 - name : Upload reports
Original file line number Diff line number Diff line change @@ -122,9 +122,20 @@ def get_tech_losers(self) -> List[FilteredStock]:
122122 self .scan_source = "fmp-quotes"
123123 return self .get_tech_losers () # Recursively call with new mode
124124 else :
125- losers = self .fmp .scan_tech_universe (limit = self .sample_size )
126- from .tech_universe import get_universe_size
127- self ._stats ["total_scanned" ] = get_universe_size (limit = self .sample_size )
125+ # Default: Twelve Data (Primary) with FMP Fallback
126+ # User Preference: "Multiple 12 data API keys to scan 545 stocks... FMP as fallback"
127+ print ("[Source] Using Twelve Data (Primary) - Multi-Key Scan" )
128+ try :
129+ # This automatically uses multiple keys if configured in env/secrets
130+ losers = self .fmp .scan_tech_universe (limit = self .sample_size )
131+ from .tech_universe import get_universe_size
132+ self ._stats ["total_scanned" ] = get_universe_size (limit = self .sample_size )
133+ except Exception as e :
134+ print (f"\n [Error] Twelve Data scan failed: { e } " )
135+ print ("[Fallback] Switching to FMP Biggest Losers Feed (Safe Mode)..." )
136+ # Fallback to the single-request FMP feed (always safe)
137+ losers = self .fmp .get_biggest_losers_fmp ()
138+ self ._stats ["total_scanned" ] = len (losers )
128139 self ._stats ["total_losers" ] = len (losers )
129140
130141 if not losers :
You can’t perform that action at this time.
0 commit comments