fix(limitless): wire unwatchOrderBook to WebSocket unsubscribe#1692
Open
JSap0914 wants to merge 1 commit into
Open
fix(limitless): wire unwatchOrderBook to WebSocket unsubscribe#1692JSap0914 wants to merge 1 commit into
JSap0914 wants to merge 1 commit into
Conversation
LimitlessExchange never overrode unwatchOrderBook, so calling it always threw "unwatchOrderBook() is not supported by Limitless" even though LimitlessWebSocket.unsubscribe() already existed. Add an unwatchOrderBook override that resolves the outcome slug (mirroring watchOrderBook) and forwards it to the websocket's unsubscribe(), removing the market-price subscription. The capability is now reported as supported via the automatic capability derivation. Fixes pmxt-dev#1660
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.
What
LimitlessExchangenever overrodeunwatchOrderBook, so calling it alwaysthrew
unwatchOrderBook() is not supported by Limitlessfrom the base class —even though
LimitlessWebSocket.unsubscribe()was already implemented.This adds an
unwatchOrderBookoverride that resolves the outcome slug(mirroring the existing
watchOrderBookoverride) and forwards it to thewebsocket's
unsubscribe(), which removes thesubscribe_market_pricessubscription and drops the cached orderbook/price callbacks.
Why
watchOrderBookopened a subscription that could never be torn down throughthe public API, so consumers had no supported way to stop streaming a market's
orderbook. The websocket already exposed
unsubscribe(); this simply wires itinto the exchange interface.
The capability now reports as supported automatically via the base class's
capability derivation (
exchange.has.unwatchOrderBook === true).Tests
Added
core/test/unit/limitless-unwatch-orderbook.core.test.ts:watchOrderBookthenunwatchOrderBookforwards the resolved slug toLimitlessWebSocket.unsubscribe()(verified via a spy) instead of throwing.exchange.has.unwatchOrderBooknow reportstrue.Fixes #1660