Files
OpenFin/backend/services
OpenSquared 281b7e30ba fix: forward curve — stop 40+ yfinance errors per cycle, batch downloads
Two root causes in the logs:
1. fetch_forward_curves() tried 5 offsets × 8 commodities = 40 individual
   yfinance requests for monthly contracts (CLN26, GCQ26, etc.) that Yahoo
   Finance does not support — generating ERROR storm and triggering hard
   rate limiting that cascades onto front-month CL=F/GC=F calls used by
   the main cycle.
2. Ticker format lacked exchange suffix (.NYM/.CMX/.CBT).

Fix: replace the per-ticker loop with two batch yfinance.download() calls
(one for all 8 front-months, one for all deferred candidates). Failed
deferred lookups are logged at DEBUG level and reported as structure='unknown'
rather than ERROR, since Yahoo Finance does not expose monthly commodity
contracts reliably. Added 1s sleep between batches to avoid rate spiking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 08:30:15 +02:00
..