feat(yahoo): add GB (London Stock Exchange) support to Yahoo Finance data collector#2155
Open
kaish114 wants to merge 8 commits intomicrosoft:mainfrom
Open
feat(yahoo): add GB (London Stock Exchange) support to Yahoo Finance data collector#2155kaish114 wants to merge 8 commits intomicrosoft:mainfrom
kaish114 wants to merge 8 commits intomicrosoft:mainfrom
Conversation
Author
@microsoft-github-policy-service agree |
4 tasks
The GB symbol fetch paginates Yahoo Finance screener in a tight loop (up to 6 requests for ~1400 symbols). Without a delay between pages, Yahoo returns 429 Too Many Requests on the second request. Add a 1-second sleep after each full page to stay within rate limits.
Yahoo Finance blocks the Chrome UA string but accepts a plain Mozilla/5.0 agent, consistent with the existing BR collector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds GB (London Stock Exchange) support to the Yahoo Finance data collector, following the same pattern as the existing IN (India) and BR (Brazil) implementations.
Changes
scripts/data_collector/utils.py"GB_ALL": "^FTSE"toCALENDAR_BENCH_URL_MAP— uses FTSE 100 index as the trading-calendar benchmark, consistent with^NSEI(India) and^BVSP(Brazil)_GB_SYMBOLSmodule-level cacheget_calendar_list()to handleGB_prefixed bench codesget_gb_stock_symbols()— fetches symbols from the Yahoo Finance predefinedmost_actives_gbscreener API with pagination (250 per page), filtering to.L-suffixed symbols (~960 LSE-listed equities)scripts/data_collector/yahoo/collector.pyYahooCollectorGB,YahooCollectorGB1d,YahooCollectorGB1minYahooNormalizeGB,YahooNormalizeGB1d,YahooNormalizeGB1dExtend,YahooNormalizeGB1minEurope/London; symbol format:.Lsuffix (e.g.HSBA.L,AZN.L)YahooNormalizeGB1minsetsAM_RANGE = ("08:00:00", "16:29:00")to reflect the LSE continuous session (no midday break)scripts/data_collector/yahoo/README.md— add GB download/normalize examples and a note on GBp (pence) pricingscripts/data_collector/README.md— update supported regions list (also fixes existing omission of IN and BR)tests/test_yahoo_collector_gb.py— 21 unit tests covering symbol fetching, pagination, caching, calendar routing, class existence, timezone, andRunclass-name resolutionSymbol source
Symbols are fetched from the Yahoo Finance predefined screener endpoint:
This endpoint requires no authentication, supports
startoffset pagination, and returns symbols already validated by Yahoo Finance — guaranteeing that collected symbols will have price data available. The full GB market universe (~1,432 securities, ~960.Lequities) is covered across 6 paginated requests.Testing
All changed files formatted with
black -l 120.Usage