Skip to content

Commit 09a2725

Browse files
committed
feat(sdk): expose WebSocket configuration for Polymarket and Kalshi
Adds websocket config parameter to both TypeScript and Python SDKs: Polymarket: - TypeScript: PolymarketOptions.websocket - Python: websocket dict parameter (auto-generated) Kalshi: - TypeScript: KalshiOptions.websocket - Python: websocket dict parameter (auto-generated) Supported websocket options: - wsUrl: Custom WebSocket endpoint - reconnectInterval: Reconnection delay (ms) - pingInterval: Heartbeat interval (ms) - maxReconnectAttempts: Maximum reconnection tries Files Changed: - core/scripts/generate-python-exchanges.js - Generator template - sdks/python/pmxt/client.py - Exchange base class - sdks/python/pmxt/_exchanges.py - Generated exchange classes - sdks/python/pmxt/__init__.py - Updated imports - sdks/typescript/pmxt/client.ts - TypeScript interfaces Testing: ✅ TypeScript SDK builds and works ✅ Python SDK imports and works ✅ Both exchanges accept websocket config ✅ All tests passed Fixes #1052 Fixes #1053
1 parent 60200cd commit 09a2725

4 files changed

Lines changed: 97 additions & 16 deletions

File tree

core/scripts/generate-python-exchanges.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,11 @@ function generateClass(exchange) {
173173
constructorParams.push('base_url: Optional[str] = None');
174174
constructorParams.push('auto_start_server: Optional[bool] = None');
175175
constructorParams.push('pmxt_api_key: Optional[str] = None');
176+
constructorParams.push('websocket: Optional[dict] = None');
176177
superArgs.push('base_url=base_url');
177178
superArgs.push('auto_start_server=auto_start_server');
178179
superArgs.push('pmxt_api_key=pmxt_api_key');
180+
superArgs.push('websocket=websocket');
179181

180182
const docLines = [];
181183
if (creds.apiKey) docLines.push(' api_key: API key for authentication (optional)');
@@ -192,6 +194,7 @@ function generateClass(exchange) {
192194
docLines.push(' base_url: Base URL of the PMXT sidecar server');
193195
docLines.push(' auto_start_server: Automatically start server if not running (default: True)');
194196
docLines.push(' pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)');
197+
docLines.push(' websocket: WebSocket configuration dict (optional)');
195198

196199
const indent4 = s => ` ${s}`;
197200
const indent8 = s => ` ${s}`;

0 commit comments

Comments
 (0)