Skip to content

feat(streams): add public best bid and ask subscriptions - #384

Open
kartojal wants to merge 3 commits into
mainfrom
feat/public-bbo-subscriptions
Open

kartojal wants to merge 3 commits into
mainfrom
feat/public-bbo-subscriptions

Conversation

@kartojal

@kartojal kartojal commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Add PolymarketPriceSpec(asset_ids=[...]) to async public and secure client subscriptions, following the public websocket contract. Typed events expose best bid/ask quotes, populated or empty initial snapshots, and live changes. Public subscriptions use an unauthenticated connection pool; existing market websocket subscriptions retain their transport.

Validation: 282 focused realtime tests and the full unit suite (3,521 passed, 190 integration tests deselected) passed. Ruff lint, formatting, and Pyright passed. A local websocket peer covers request encoding, dispatch by asset, malformed-frame neighbors, shared-listener replay, reconnect/resubscription, and cleanup.


Note

Medium Risk
New websocket parsing and subscription routing in shared realtime infrastructure; mistakes could mis-attribute snapshots or break existing price streams, though polymarket BBO uses a separate client manager and optional auth path.

Overview
Adds PolymarketPriceSpec(asset_ids=[...]) so public and secure clients can subscribe to realtime best bid/ask quotes on the price.polymarket websocket channel, with typed PolymarketPriceEvent snapshots and updates.

The realtime stack now keys subscriptions by asset_id, encodes price.polymarket wire filters, and parses frames via parse_polymarket_price_event (including empty cold snapshots correlated to filters through subscribe ack order). PriceConnection treats API credentials as optional and skips auth for these public feeds; public clients use a dedicated unauthenticated RealtimeStreamManager, while secure clients keep a separate pool from authenticated crypto/equity price streams.

Exports, subscribe overloads, and session snapshot/replay behavior are extended for polymarket BBO; unit tests cover encoding, malformed frames, shared-listener replay, reconnect, and asset-id validation.

Reviewed by Cursor Bugbot for commit 50cfc79. Bugbot is set up for automated code reviews on this repo. Configure here.

@kartojal
kartojal marked this pull request as ready for review October 26, 2026 13:24

This branch has not been deployed

No deployments
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.

1 participant