Repository navigation
fix(common): use enum values in WebSocket stream names - #577
Open
Amadeus-22 wants to merge 1 commit into
Open
Amadeus-22 wants to merge 1 commit into
Amadeus-22 wants to merge 1 commit into
Conversation
ws_streams_placeholder filled placeholders with str(value), so an enum passed to a generated stream method (e.g. spot kline(interval= KlineIntervalEnum.INTERVAL_1m)) produced btcusdt@kline_KlineIntervalEnum.INTERVAL_1m and the subscription never received data. Unwrap Enum members to their value, as the REST and WebSocket API paths already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The generated stream methods are typed to take enums (spot
kline(interval: KlineIntervalEnum),ticker_rolling_window(window_size: ...), futurescontinuous_contract_kline_candlestick_streams(contract_type: ..., interval: ...)and others), butws_streams_placeholderfills placeholders withstr(value), so passing the enum builds a stream name that doesn't exist:The subscription is accepted but never receives data; the examples only work because they pass
.value. The REST (make_serializable) and WebSocket API paths already unwrap enums; this does the same for stream names.Added
TestWsStreamsPlaceholder.test_enum_values_are_unwrapped(kline, continuousKline, ticker window size). It fails on master and passes with the fix;pytest tests/unitincommon/passes (404). flake8 is clean;black --checkflags only a pre-existing docstring inRedactedRepr, untouched here.🤖 Generated with Claude Code