Repository navigation
KalshiExchangeOptions.websocket (KalshiWebSocketConfig) not passable through either SDK #1053
Description
Gap
KalshiExchangeOptions in core accepts an optional websocket?: KalshiWebSocketConfig field for configuring the underlying Kalshi WebSocket connection (custom wsUrl, etc.). Neither the TypeScript SDK Kalshi constructor nor the Python SDK Kalshi.__init__ expose this field, so it is silently ignored and the sidecar always uses the default Kalshi WebSocket URL.
Note: the same class of gap exists for Opinion (OpinionExchangeOptions.websocket, #973) and Probable (wsConfig, #972), and Polymarket (#1052). This issue is specifically for Kalshi.
Core
core/src/exchanges/kalshi/index.ts
KalshiExchangeOptions.websocket?: KalshiWebSocketConfig— line 45- The config is stored as
this.wsConfig(line 55) and read at line 67 - Used in
ensureWs()to constructKalshiWebSocketwith a merged config at lines 425–429, 438–442, 456–460
KalshiWebSocketConfig and KalshiWebSocket are defined in core/src/exchanges/kalshi/websocket.ts and re-exported from the exchange index at line 41.
TypeScript SDK
sdks/typescript/pmxt/client.ts — Kalshi class (line 3091–3095):
export class Kalshi extends Exchange {
constructor(options: ExchangeOptions = {}) {
super("kalshi", options);
}
}ExchangeOptions (the base interface) has no websocket field. The constructor does not define a venue-specific options interface that could carry one.
Python SDK
sdks/python/pmxt/_exchanges.py — Kalshi.__init__ (line 122–150):
def __init__(
self,
api_key: Optional[str] = None,
private_key: Optional[str] = None,
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
# websocket parameter absent
) -> None:Evidence
Users who need a custom Kalshi WebSocket URL (e.g. targeting the Kalshi demo environment's WS endpoint separately from the REST base URL, or using a proxy) have no SDK path:
// Desired — currently impossible in TypeScript SDK:
const kalshi = new pmxt.Kalshi({
apiKey: "...",
privateKey: "...",
websocket: {
wsUrl: "wss://demo-api.kalshi.co/trade-api/ws/v2",
},
});# Desired — currently impossible in Python SDK:
kalshi = pmxt.Kalshi(
api_key="...",
private_key="...",
websocket={"ws_url": "wss://demo-api.kalshi.co/trade-api/ws/v2"},
)Impact
SDK users cannot override the Kalshi WebSocket endpoint or configure reconnect behavior. The sidecar always derives the WebSocket URL from the hardcoded default. This matters especially for KalshiDemo users who may need a different WS URL than the production instance, and for users behind WebSocket proxies.
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'sKalshiWebSocketConfig(core/src/exchanges/kalshi/websocket.ts:12-19, exposed asKalshiExchangeOptions.websocketatcore/src/exchanges/kalshi/index.ts:45). None of core's real field names (wsUrl,reconnectIntervalMs,watchTimeoutMsas defined onKalshiWebSocketConfig) are wired through, andcore/src/server/exchange-factory.ts'screateExchange()still takes no websocket-config parameter and passes none through at itsnew KalshiExchange({...})call site. This issue should remain open — please don't treat PR #1126 as resolving it.Generated by Claude Code