Repository navigation
fix(collector): support ETN/ETF symbols in name lookup - #13
Merged
Merged
Conversation
Toss name API supports ETN symbols like 0197W0 (SOL SK하이닉스단일종목레버리지),
but validateSymbols() rejected anything not matching \d{6}, leaving ETN
ranking rows with null names. Allow 4-digit + 2-alphanumeric codes in
name lookups while keeping \d{6} for price/chart endpoints.
mytrashcan
commented
Jul 31, 2026
mytrashcan
left a comment
Owner
Author
There was a problem hiding this comment.
Code Review Summary
Verdict: Looks good — mergeable
Verified OK
- Root cause is precise: Toss name API supports ETN symbols (
0197W0→SOL SK하이닉스단일종목레버리지, verified live), butfetchStockNames()validation rejected anything not matching\d{6}. - Fix is correctly scoped:
NAME_LOOKUP_SYMBOL(\d{6}|\d{4}[A-Z0-9]{2}) applies only to name lookups; price/chart endpoints keep strict\d{6}viaKRX_SYMBOL— no behavior change for price data. StockReferenceService.refreshSymbols()filter now admits ETN/ETF codes while still dropping arbitrary junk symbols (e.g.UNKNOWN_SYMBOLnever reaches the upstream call).- Test updated to prove both directions: ETN codes reach the API and resolve names; junk symbols are filtered out.
- Full suite passes:
./gradlew clean check→ BUILD SUCCESSFUL.
Good Things
- Verified against the live Toss API before writing the fix — the validation was stricter than the upstream actually is.
- Separate validation path for name lookups keeps the security posture of price/chart endpoints unchanged.
Reviewed by Hermes Agent - deepseek-v4-flash
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
Fixes remaining
name: nullrows on the ranking dashboard for ETN/ETF symbols (0193T0,0197W0,0197X0, etc.).Root cause: The previous fix (PR #12) filtered name lookups to six-digit symbols only. But the Toss name API does support ETN symbols —
GET /api/v1/stocks?symbols=0197W0returnsSOL SK하이닉스단일종목레버리지. The strict\d{6}validation infetchStockNames()rejected those codes, so ETN ranking rows never resolved their display names.Fix:
TossMarketDataClient: added aNAME_LOOKUP_SYMBOLpattern (\d{6}|\d{4}[A-Z0-9]{2}) used only byfetchStockNames()validation. Price/chart endpoints keep the strict\d{6}rule — Toss rejects non-six-digit codes there.StockReferenceService:refreshSymbols()now passes both six-digit and ETN-style codes to the name API, while still filtering out arbitrary junk symbols.Changes
TossMarketDataClient.java:NAME_LOOKUP_SYMBOLpattern +isValidNameLookupSymbol()forvalidateSymbols()StockReferenceService.java: relaxedrefreshSymbols()filter to accept ETN/ETF codesStockReferenceServiceTest.java: test now asserts ETN codes reach the name API and resolve their namesTest plan
./gradlew test --tests 'com.marketguard.collector.StockReferenceServiceTest' --tests 'com.marketguard.collector.client.TossMarketDataClientCharacterizationTest'→ pass./gradlew clean check --no-daemon --no-parallel→ BUILD SUCCESSFUL0197W0→SOL SK하이닉스단일종목레버리지