feat(cli): native real-time websocket integration with organized output#35
Open
max-de-bug wants to merge 6 commits intoPolymarket:mainfrom
Open
feat(cli): native real-time websocket integration with organized output#35max-de-bug wants to merge 6 commits intoPolymarket:mainfrom
max-de-bug wants to merge 6 commits intoPolymarket:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Author
|
@suhailkakar I’d appreciate your feedback on this feature. |
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.
Native Real-Time WebSocket Integration
Summary
Adds the
polymarket streamcommand suite — a native WebSocket client that connects directly to the Polymarket CLOB real-time API (wss://ws-subscriptions-clob.polymarket.com/ws/market) usingtokio-tungstenite. No dependency on the SDK's WebSocket module.Motivation
Users previously had no way to monitor live market activity from the CLI. This feature enables real-time streaming of orderbook depth, price changes, trade executions, and midpoint prices — essential for market-making bots, live dashboards, and manual monitoring workflows.
New Commands
| Command | | Description |
| polymarket stream orderbook <token_ids> | Live bid/ask depth snapshots |
| polymarket stream prices <token_ids> | Real-time price changes (BUY/SELL) |
| polymarket stream last-trade <token_ids> | Trade execution updates |
| polymarket stream midpoints <token_ids> | Continuous midpoint price feeds |
polymatket_cli_wb_video.mp4
Note
Medium Risk
Adds new network-facing WebSocket functionality and several new TLS/WebSocket dependencies, which could introduce runtime/connectivity issues despite being largely isolated from existing command flows.
Overview
Adds a new
polymarket streamcommand family (orderbook, price changes, last trade, midpoints) that opens a native WebSocket connection to Polymarket’s CLOB endpoint, filters events byevent_type, supports--max-events, and exits cleanly on Ctrl+C.Introduces a small
wsmodule to manage subscription and tolerant event parsing (handles single-object vs array frames and skips non-event messages), plus a dedicatedoutput::streamformatter for NDJSON or compact table-style lines. Updates dependencies to includetokio-tungstenite/rustls/futures-utiland enables Tokio’ssignalfeature; adds an example WebSocket test and CLI help/arg coverage in integration tests.Written by Cursor Bugbot for commit 1de653c. This will update automatically on new commits. Configure here.