Log the symbols Yahoo dropped from a batch quote request - #57
Open
werwolfby wants to merge 1 commit into
Open
Conversation
GetQuotesAsync returns only the symbols that resolved, with no warning, no exception and nothing naming the ones that did not. The leniency itself is useful - it is what makes a mixed batch survive a bad ticker - but the omission was unobservable, so a caller doing a scheduled refresh had to diff requested against returned symbols by hand to find bad tickers. Diff the request against the response and log a warning naming the symbols Yahoo returned no data for. Matching ignores casing, since the request is lower-cased on the way out and Yahoo answers with canonical symbols. The returned collection is unchanged.
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.
A batch quote request returns only the symbols that resolved, with no indication that the others were dropped:
No warning logged, no exception, nothing naming
BOGUSTICKER. A consumer doing a scheduled refresh cannot tell "this ticker is invalid" from "this ticker was temporarily unavailable" without diffing the request against the response by hand.Changes
GetQuotesAsyncnow diffs requested against returned symbols and logs a warning naming the ones Yahoo returned no data for. Matching ignores casing, since the request is lower-cased on the way out while Yahoo answers with canonical symbols. The returned collection is unchanged.Scope, and what this deliberately does not do
It does not throw. The lenient behaviour is genuinely useful — it is exactly what lets a mixed batch survive one bad symbol (95 ms) where a solo bad symbol does not. Failing the whole batch because one ticker went stale would break every caller currently relying on partial results, and would be a worse default for the common case. The gap was never the leniency; it was that the omission was unobservable. A log warning closes that at zero compatibility cost.
It does not change the signature. The obvious alternative is returning a richer result type carrying per-symbol success and failure, but that would be new public API surface for information the caller already holds: they passed the symbol list in, and they get the resolved symbols back, so the shortfall is derivable from the response. Adding a type to carry a derivable value is not worth the API cost, and the existing shape stays the simple one.
So the change is intentionally the smallest thing that makes the behaviour visible: same return value, same exceptions, one warning.
Tests
Adds
DroppedSymbolLoggingTests:The last two are the ones that matter for false positives — a warning that fires on every successful call is worse than no warning at all.
TestCategory=Unitpasses: 159 tests, 0 failures. No new analyzer warnings.Note
Independent of #55 (cancellation) and #56 (no-data), and unlike those two it touches only
GetQuotesAsync, so it should merge without conflicts in any order.These changes were generated with Claude Code, and I have reviewed them.
🤖 Generated with Claude Code