Use this file to discover all available pages before exploring further.
WebSocket endpoint — This method uses WebSocket streaming, not HTTP. Connect to wss://api.pmxt.dev/ws?apiKey=YOUR_KEY (hosted) or ws://localhost:3847/ws (local server).
import pmxtexchange = pmxt.Polymarket(pmxt_api_key="YOUR_PMXT_API_KEY")# Stream orderbook updates — each call returns the next snapshotwhile True: book = exchange.watch_order_book("OUTCOME_ID", limit=10) if not book.bids or not book.asks: continue print(f"Best bid: {book.bids[0].price} ({book.bids[0].size} contracts)") print(f"Best ask: {book.asks[0].price} ({book.asks[0].size} contracts)") print(f"Spread: {book.asks[0].price - book.bids[0].price:.4f}")
Watch the same market on two venues to detect arbitrage:
import pmxtimport asynciopoly = pmxt.Polymarket(pmxt_api_key="YOUR_PMXT_API_KEY")kalshi = pmxt.Kalshi(pmxt_api_key="YOUR_PMXT_API_KEY")# Run both in parallel (simplified)while True: poly_book = poly.watch_order_book("POLY_OUTCOME_ID") kalshi_book = kalshi.watch_order_book("KALSHI_OUTCOME_ID") if not poly_book.bids or not kalshi_book.asks: continue spread = poly_book.bids[0].price - kalshi_book.asks[0].price if spread > 0.02: print(f"Arbitrage opportunity: {spread:.4f}")