Skip to content

clean up nyse symbols in stock.yml (#1928) - #1932

Merged
asolntsev merged 1 commit into
datafaker-net:mainfrom
baaska23:fix/1928-clean-nyse-symbols
Oct 25, 2026
Merged

asolntsev merged 1 commit into
datafaker-net:mainfrom
baaska23:fix/1928-clean-nyse-symbols

Conversation

@baaska23

@baaska23 baaska23 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1928

The symbol_nyse list had a bunch of weird stuff in it, like preferred shares with ^ (JPM^A), warrants (JPM.WS), stuff like OSG$ and some tickers padded with a ton of trailing spaces. I removed all of those so its just plain tickers now.

also checked the rest against the current nasdaq trader symbol directory (otherlisted.txt, exchange N) and dropped the ones that arent on nyse anymore (NVTA, IRET, STAR, JAX, IO etc, plus some that moved to nasdaq like AXON). went from 3167 -> 1409 entries

the regex in the test was kinda broken too ([A-Z.-^$` ] basically matches everything bc of the .-^ range) so i changed it to [A-Z]{1,4} and added a test that checks the whole list instead of just 10 random ones

ok so the symbol_nyse list had a bunch of weird stuff in it, like
preferred shares with ^ (JPM^A), warrants (JPM.WS), stuff like OSG$
and some tickers padded with a ton of trailing spaces lol. removed
all of those so its just plain tickers now

also checked the rest against the current nasdaq trader symbol
directory (otherlisted.txt, exchange N) and dropped the ones that
arent on nyse anymore (NVTA, IRET, STAR, JAX, IO etc, plus some that
moved to nasdaq like AXON). went from 3167 -> 1409 entries

the regex in the test was kinda broken too ([A-Z.-^$` ] basically
matches everything bc of the .-^ range) so i changed it to
[A-Z]{1,4} and added a test that checks the whole list instead of
just 10 random ones

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@what-the-diff

what-the-diff Bot commented Oct 14, 2026

Copy link
Copy Markdown

PR Summary

  • Strengthened NYSE ticker validation
    Tests now require ticker symbols to contain only 1–4 uppercase letters.
  • Checked the NYSE symbol list for consistency
    Added a test to ensure the list contains no duplicate symbols and every entry follows the required format.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.31%. Comparing base (1d34e4f) to head (d36b663).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1932      +/-   ##
============================================
- Coverage     92.36%   92.31%   -0.06%     
+ Complexity     3559     3557       -2     
============================================
  Files           348      348              
  Lines          7051     7051              
  Branches        691      691              
============================================
- Hits           6513     6509       -4     
- Misses          371      373       +2     
- Partials        167      169       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@asolntsev asolntsev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up! I checked the new symbol_nyse list against NASDAQ Trader's otherlisted.txt (Exchange=N): all 1409 entries are currently NYSE-listed, and no duplicates or padding remain. A few points below.

Also: the same padding bug as #1928 is still in symbol_nsdq (e.g. "BLIN ", "ENZY ", "IMNP ", "TORM "). The nsdqSymbol test regex [A-Z. -]+ allows spaces, so it goes unnoticed. It would be worth trimming and adding a whole-list check for every symbol_* list.

@@ -4,321 +4,147 @@ en:
symbol_nyse:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "letters only" filter also drops real NYSE common-stock class tickers: BRK.A, BRK.B, BF.A, BF.B are listed in otherlisted.txt as common stock on NYSE. After this change nyseSymbol() can never return Berkshire Hathaway. Could we exclude only preferred shares and warrants (^, /, $, .WS) and keep the class shares?

Smaller points about this list:

  • HF and TPZ are ETFs (ETF=Y in otherlisted.txt). If the list is meant to be stocks only, also filter on the ETF column.
  • A comment noting the source (otherlisted.txt, Exchange=N) and the snapshot date would make the next refresh easier.
  • The list goes from about 2657 to 1409 distinct tickers, so unique() users run out sooner and seeded outputs change. Probably worth a changelog note.

void nyseSymbolsArePlainTickers() {
assertThat(getBaseList(faker, "stock.symbol_nyse"))
.doesNotHaveDuplicates()
.allMatch(symbol -> symbol.matches("[A-Z]{1,4}"));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[A-Z]{1,4} is stricter than the real NYSE format and rejects BRK.B / BF.B. How about [A-Z]{1,4}(\\.[A-Z])?? It still blocks ^, /, $ and .WS.

}

@Test
void nyseSymbolsArePlainTickers() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AbstractProviderListTest already supports a per-key regex: TestSpec.of(stock::nyseSymbol, "stock.symbol_nyse", "<regex>") in providerListTest() would replace this method and the extra Test import.

@RepeatedTest(10)
void nyseTicker() {
assertThat(faker.stock().nyseSymbol()).matches("[A-Z.-^$` ]+");
assertThat(faker.stock().nyseSymbol()).matches("[A-Z]{1,4}");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that every entry is checked against the same regex, this @RepeatedTest(10) adds no coverage. It could be dropped, which also leaves the regex in one place.

@asolntsev asolntsev added this to the 3.0.0 milestone Oct 14, 2026
@asolntsev
asolntsev merged commit a941a52 into datafaker-net:main Oct 25, 2026
17 checks passed
@asolntsev asolntsev self-assigned this Oct 25, 2026
@asolntsev

Copy link
Copy Markdown
Collaborator

Merged and followed-up by #1944

asolntsev added a commit that referenced this pull request Oct 25, 2026
… stock lists

* restore 22 NYSE class shares still listed as common stock (BRK.A, BRK.B, BF.A, BF.B, ...)
* remove ETFs HF and TPZ from symbol_nyse
* trim padded entries in symbol_nsdq (BLIN, ENZY, IMNP, TORM)
* AbstractProviderListTest: validate every list entry against the TestSpec regex
* StockTest: per-list regexes in providerListTest(), no-duplicates check, drop redundant repeated tests
* document data source of nyseSymbol() and add a release note

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Does "symbol_nyse" in stock.yml contain valid values?

3 participants