fix(messages): classify 2188 as a data advisory, not an error - #765
Merged
Conversation
TWS sends 2188 ("Up-to-the-second historical data requires additional
subscription for the API.") on the error callback and then serves the
historical data anyway — the account simply cannot have the
up-to-the-second tail. Because 2188 sits outside WARNING_CODE_RANGE
(2100..=2169) and was not in DATA_ADVISORY_CODES, classify_error routed
it as RoutedItem::Error. historical_data() inspects only the first frame
on its subscription, so it returned Err before HistoricalData arrived and
the caller got no bars at all for every instrument whose real-time feed
the account does not hold.
Add 2188 to DATA_ADVISORY_CODES, which already describes exactly this
case: an advisory on a request that then proceeds. RoutedItem::Notice is
skipped by into_legacy(), so the fetch reads the following HistoricalData
frame and returns the bars.
Regression tests on both the sync and async fetch paths push a 2188 frame
ahead of HistoricalData and assert the bars still arrive; both fail
without the classification change.
wboayue
force-pushed
the
fix/classify-2188-as-warning
branch
from
August 27, 2026 05:25
27ce874 to
eb790da
Compare
Owner
|
Thanks @ms32035 — excellent diagnosis in #764, and the live before/after verification plus regression tests on both fetch paths made this easy to confirm. I rebased onto main (resolving the overlap with #759), added a changelog entry, and updated the one remaining doc site ( |
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.
Fixes #764.
TWS sends 2188 (
Up-to-the-second historical data requires additional subscription for the API.) on the error callback and then serves the historical data anyway — the account merely cannot receive the up-to-the-second tail.Because 2188 sits outside
WARNING_CODE_RANGE(2100..=2169) and was not inDATA_ADVISORY_CODES,classify_errorrouted it asRoutedItem::Error.historical_data()inspects only the first frame on its subscription, so it returnedErrbeforeHistoricalDataarrived and the caller got no bars at all for every instrument whose real-time feed the account does not hold.Change
Add 2188 to
DATA_ADVISORY_CODES, whose doc comment already describes this case: an advisory on a request that then proceeds.RoutedItem::Noticeis skipped byinto_legacy(), so the fetch reads the followingHistoricalDataframe and returns the bars. Both the sync and async paths go through the same classifier, so the one constant covers both.Tests
Regression tests on both fetch paths push a 2188 frame ahead of
HistoricalDataand assert the bars still arrive. Both fail onmainwithout the classification change:Verified against a live gateway: a bulk daily-bar gather over a US equity universe on an account without NYSE Network A returned no bars for the affected symbols before the change, and the full history after it.
Checks
All clean.