Skip to content

fix(limitless): wire unwatchOrderBook to WebSocket unsubscribe#1692

Open
JSap0914 wants to merge 1 commit into
pmxt-dev:mainfrom
JSap0914:fix/1660-limitless-unwatch-orderbook
Open

fix(limitless): wire unwatchOrderBook to WebSocket unsubscribe#1692
JSap0914 wants to merge 1 commit into
pmxt-dev:mainfrom
JSap0914:fix/1660-limitless-unwatch-orderbook

Conversation

@JSap0914

Copy link
Copy Markdown

What

LimitlessExchange never overrode unwatchOrderBook, so calling it always
threw unwatchOrderBook() is not supported by Limitless from the base class —
even though LimitlessWebSocket.unsubscribe() was already implemented.

This adds an unwatchOrderBook override that resolves the outcome slug
(mirroring the existing watchOrderBook override) and forwards it to the
websocket's unsubscribe(), which removes the subscribe_market_prices
subscription and drops the cached orderbook/price callbacks.

Why

watchOrderBook opened a subscription that could never be torn down through
the public API, so consumers had no supported way to stop streaming a market's
orderbook. The websocket already exposed unsubscribe(); this simply wires it
into 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:

  • watchOrderBook then unwatchOrderBook forwards the resolved slug to
    LimitlessWebSocket.unsubscribe() (verified via a spy) instead of throwing.
  • exchange.has.unwatchOrderBook now reports true.
# focused
npx jest -c jest.config.js test/unit/limitless-unwatch-orderbook.core.test.ts
  Tests: 2 passed, 2 total

# full core suite
npx jest -c jest.config.js
  Test Suites: 48 passed, 1 skipped, 49 total
  Tests: 812 passed, 3 skipped, 815 total

# type check
npx tsc --noEmit   # exit 0

# generators (no drift)
node core/scripts/check-exchange-drift.js   # No drift. All layers in sync.
node core/scripts/generate-compliance.js    # COMPLIANCE.md unchanged

Fixes #1660

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limitless unwatchOrderBook not implemented despite LimitlessWebSocket.unsubscribe() existing

1 participant