Repository navigation
PolymarketExchangeOptions.websocket (PolymarketWebSocketConfig) not passable through either SDK #1052
Description
Gap
PolymarketExchangeOptions in core accepts an optional websocket?: PolymarketWebSocketConfig field that lets callers configure the underlying Polymarket WebSocket connection (URL overrides, channel settings, reconnect behavior, etc.). Neither the TypeScript SDK PolymarketOptions interface nor the Python SDK Polymarket.__init__ expose this field, so it is silently dropped and the sidecar always uses defaults.
Note: the same class of gap exists for Opinion (OpinionExchangeOptions.websocket, #973) and Probable (wsConfig, #972). This issue is specifically for Polymarket.
Core
core/src/exchanges/polymarket/index.ts
PolymarketExchangeOptions.websocket?: PolymarketWebSocketConfig— line 56- The config is read at line 80 and stored as
this.wsConfig(line 88) - Used when
ensureWs()constructs thePolymarketWebSocketinstance at line 773
core/src/exchanges/polymarket/websocket.ts — defines PolymarketWebSocketConfig and WatcherConfig; both types are re-exported from the exchange index at line 51.
TypeScript SDK
sdks/typescript/pmxt/client.ts — PolymarketOptions interface (line 3023–3044):
export interface PolymarketOptions {
apiKey?: string;
privateKey?: string;
pmxtApiKey?: string;
baseUrl?: string;
autoStartServer?: boolean;
proxyAddress?: string;
signatureType?: 'eoa' | 'poly-proxy' | 'gnosis-safe' | number;
// websocket field is absent
}The constructor (line 3047) passes options straight through to the sidecar as ExchangeOptions; there is no websocket key in the wire format.
Python SDK
sdks/python/pmxt/_exchanges.py — Polymarket.__init__ (line 13–56):
def __init__(
self,
api_key: Optional[str] = None,
api_secret: Optional[str] = None,
passphrase: Optional[str] = None,
private_key: Optional[str] = None,
proxy_address: Optional[str] = None,
signature_type: Optional[str] = "gnosis-safe",
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
wallet_address: Optional[str] = None,
signer: Optional[object] = None,
# websocket parameter absent
) -> None:Evidence
Users who need to override the Polymarket WebSocket endpoint (e.g. pointing at a staging environment, adjusting reconnect timeouts, or subscribing to specific user-channel events) have no way to pass the config through the SDK:
// Desired — currently impossible in TypeScript SDK:
const poly = new pmxt.Polymarket({
apiKey: "...",
websocket: {
wsUrl: "wss://custom-ws.example.com",
reconnectInterval: 5000,
},
});# Desired — currently impossible in Python SDK:
poly = pmxt.Polymarket(
api_key="...",
websocket={"ws_url": "wss://custom-ws.example.com"},
)Impact
SDK users cannot customize Polymarket WebSocket behavior. The sidecar always uses the hardcoded default WebSocket URL and settings. This blocks users who need staging-environment access, custom reconnect policies, or specific user-channel event filtering that PolymarketWebSocketConfig and WatcherConfig enable in core.
Activity
fix(sdk): restore wallet_address/signer and wire websocket config
feat(sdk): expose WebSocket configuration for Polymarket and Kalshi
fix(sdk): restore wallet_address/signer and wire websocket config
feat(sdk): expose WebSocket configuration for Polymarket and Kalshi
fix(python): regenerate _exchanges.py after rebase
fix(sdk): restore wallet_address/signer and wire websocket config
feat(sdk): expose WebSocket configuration for Polymarket and Kalshi
fix(python): regenerate _exchanges.py after rebase
fix(python): complete WebSocket config wiring
fix(sdk): restore wallet_address/signer and wire websocket config
feat(sdk): expose WebSocket configuration for Polymarket and Kalshi
fix(python): regenerate _exchanges.py after rebase
fix(python): complete WebSocket config wiring
realfishsam commentedon Sep 5, 2026
Additional context from duplicate #1759: PR #1126 ("feat(sdk): expose WebSocket configuration for Polymarket and Kalshi"), which is linked as closing this issue, does not actually fix it. It adds a same-named
websocketoption to both SDKs, but that option configuresWsClientConfig(sdks/typescript/pmxt/ws-client.ts) — the local SDK↔sidecar transport socket — not core'sPolymarketWebSocketConfig(core/src/exchanges/polymarket/websocket.ts:53-68, exposed asPolymarketExchangeOptions.websocketatcore/src/exchanges/polymarket/index.ts:56). None of core's real field names (flushIntervalMs,watcherConfig,userChannelCreds,connectionTimeoutMs,snapshotFallbackMs) exist anywhere in either SDK, andcore/src/server/exchange-factory.ts'screateExchange()still takes no websocket-config parameter and passes none through at itsnew PolymarketExchange({...})call site. This issue should remain open — please don't treat PR #1126 as resolving it.Generated by Claude Code