Repair Polymarket API Integration

Замовник: AI | Опубліковано: 25.01.2026

My current Python script is supposed to pull live order-book depth and recent trades from Polymarket’s Gamma and CLOB APIs on a 15-minute loop, yet the calls either time-out or come back empty. The same keys succeed against other endpoints, so I know the credentials are good—something in the connection logic is wrong. Here’s what I need: • Identify and document the exact REST and WebSocket URLs for both Gamma and CLOB. • Patch or, if it’s cleaner, completely rewrite the failing sections so the script authenticates, streams or polls smoothly, and never drops packets within each 15-minute window. • Keep everything in Python, using requests or httpx for REST and websockets or asyncio streams for WS—whichever proves most reliable. • Provide clear inline comments for any new headers, query params, or signing steps. • Include a concise README that lists dependencies (e.g., python-dotenv, websockets, httpx), the installation command, and the one-liner I should run to start the cycle. Acceptance criteria: 1. A runnable Python file that connects, authenticates, and prints readable JSON for order-book snapshots and recent trades every 15 minutes. 2. Zero authentication errors or dropped packets in a continuous 30-minute test run. 3. Well-commented code plus the README mentioned above. Hand me that working snippet and I can fold it straight into my routine.