
Polymarket Api
Integrate Polymarket CLOB and Gamma APIs for market data, orderbooks, authenticated trading, and Python client patterns when building prediction-market tooling.
Overview
Polymarket API is an agent skill for the Build phase that guides integration with Polymarket’s CLOB and Gamma APIs for market data and order execution.
Install
npx skills add https://github.com/agentmc15/polymarket-trader --skill polymarket-apiWhat is this skill?
- Documents CLOB API (https://clob.polymarket.com) and Gamma metadata API base URLs
- Three auth levels: Level 0 public data, Level 1 signer key derive, Level 2 authenticated trading
- Key flows: markets, orderbooks, prices, place/cancel orders, positions, trades
- Python patterns using py_clob_client and ClobClient initialization
- Use when building trading features, fetching market data, or order execution
- 3 authentication levels on CLOB (public, signer, authenticated)
Adoption & trust: 868 installs on skills.sh; 24 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are building Polymarket trading or data features but lack a single map of endpoints, auth tiers, and Python client patterns.
Who is it for?
Solo builders creating trading bots, market scanners, or agent tools against Polymarket with Python and API-key workflows.
Skip if: Non-crypto products, passive SEO content about markets, or teams forbidden from handling signing keys and live order flow.
When should I use this skill?
Building Polymarket trading functionality, fetching market data, or implementing order execution; deep guide for CLOB API, Gamma API, and on-chain-aligned data.
What do I get? / Deliverables
You can implement market reads, authenticated trading calls, and client bootstrap using documented CLOB and Gamma routes and py_clob_client patterns.
- API integration plan or code using documented endpoints
- Auth-tier-appropriate client configuration
- Order and market data fetch implementations
Recommended Skills
Journey fit
External trading and market-metadata APIs are integration work during product construction, not launch SEO or ops monitoring. CLOB/Gamma endpoints, auth levels, and client initialization are third-party API integration—not generic backend CRUD alone.
How it compares
Deep API integration playbook for one venue—not a generic REST skill or an MCP market-data server.
Common Questions / FAQ
Who is polymarket-api for?
Indie developers and agent authors implementing Polymarket CLOB trading, orderbooks, and Gamma market metadata in Python-backed tools.
When should I use polymarket-api?
During Build integrations when you fetch prices, list markets, derive API keys, place or cancel orders, or read positions and trades.
Is polymarket-api safe to install?
Review the Security Audits panel on this Prism page; live trading skills imply secrets and financial risk—never commit keys and verify audit results before production use.
SKILL.md
READMESKILL.md - Polymarket Api
# Polymarket API Integration Skill ## Overview This skill provides comprehensive guidance for integrating with Polymarket's APIs and smart contracts. ## API Endpoints ### CLOB API (Central Limit Order Book) Base URL: `https://clob.polymarket.com` #### Authentication Levels - **Level 0 (Public)**: Market data, orderbooks, prices - **Level 1 (Signer)**: Create/derive API keys - **Level 2 (Authenticated)**: Trading, orders, positions #### Key Endpoints ``` GET /markets # List all markets GET /markets/{token_id} # Get specific market GET /price?token_id=X # Get current price GET /midpoint?token_id=X # Get midpoint price GET /book?token_id=X # Get orderbook GET /trades # Get user trades POST /order # Place order DELETE /order/{id} # Cancel order GET /positions # Get positions ``` ### Gamma API (Market Metadata) Base URL: `https://gamma-api.polymarket.com` ``` GET /events # List events GET /events/{slug} # Get event details GET /markets # List markets GET /markets/{id} # Get market details ``` ## Python Implementation Patterns ### Initialize Client ```python from py_clob_client.client import ClobClient from py_clob_client.clob_types import OrderArgs, OrderType import os class PolymarketService: def __init__(self): self.client = ClobClient( host="https://clob.polymarket.com", key=os.getenv("POLYMARKET_PRIVATE_KEY"), chain_id=137, signature_type=1, funder=os.getenv("POLYMARKET_FUNDER_ADDRESS") ) self.client.set_api_creds( self.client.create_or_derive_api_creds() ) async def get_market_data(self, token_id: str) -> dict: """Fetch comprehensive market data.""" return { "price": self.client.get_price(token_id, "BUY"), "midpoint": self.client.get_midpoint(token_id), "book": self.client.get_order_book(token_id), "spread": self.client.get_spread(token_id), } async def place_order( self, token_id: str, side: str, price: float, size: float, order_type: str = "GTC" ) -> dict: """Place a limit order.""" order = self.client.create_order( OrderArgs( token_id=token_id, price=price, size=size, side=side, ) ) return self.client.post_order(order, order_type) ``` ### WebSocket Subscription ```python import asyncio import websockets import json async def subscribe_market_updates(token_ids: list[str]): """Subscribe to real-time market updates.""" uri = "wss://ws-subscriptions-clob.polymarket.com/ws/market" async with websockets.connect(uri) as ws: await ws.send(json.dumps({ "type": "subscribe", "markets": token_ids })) async for message in ws: data = json.loads(message) yield data ``` ### Gamma API Client ```python import httpx class GammaClient: BASE_URL = "https://gamma-api.polymarket.com" def __init__(self): self.client = httpx.AsyncClient(base_url=self.BASE_URL) async def get_active_markets(self) -> list[dict]: """Fetch all active markets.""" response = await self.client.get("/markets", params={"active": True}) return response.json() async def get_event(self, slug: str) -> dict: """Fetch event with all markets.""" response = await self.client.get(f"/events/{slug}") return response.json() ``` ## Order Types - **GTC** (Good Till Cancelled): Stays until filled o