Complete integration guide for Polymarket's CLOB and Gamma APIs with order execution and market data.
Works with
Covers three authentication levels (public market data, signer key derivation, authenticated trading) with endpoints for orderbooks, pricing, positions, and order management
Includes Python client patterns for market data fetching, limit order placement, WebSocket subscriptions, and real-time updates via py_clob_client library
Supports four order types (GTC, GTD, FOK, IOC) with price
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionpolymarket-apiExecute the skills CLI command in your project's root directory to begin installation:
Fetches polymarket-api from agentmc15/polymarket-trader and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate polymarket-api. Access via /polymarket-api in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
3
total installs
3
this week
22
GitHub stars
0
upvotes
Run in your terminal
3
installs
3
this week
22
stars
This skill provides comprehensive guidance for integrating with Polymarket's APIs and smart contracts.
Base URL: https://clob.polymarket.com
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
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
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)
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
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()
def calculate_implied_probability(price: float) -> float:
"""Convert price to implied probability."""
return price # Prices ARE probabilities (0-1)
def calculate_cost(price: float, shares: float) -> float:
"""Calculate cost to buy shares."""
return price * shares
def calculate_pnl(
entry_price: float,
current_price: float,
shares: float,
side: str
) -> float:
"""Calculate unrealized P&L."""
if side == "BUY":
return (current_price - entry_price) * shares
return (entry_price - current_price) * shares
from py_clob_client.exceptions import PolymarketException
try:
result = client.post_order(order)
except PolymarketException as e:
if "INSUFFICIENT_BALANCE" in str(e):
# Handle insufficient funds
pass
elif "INVALID_PRICE" in str(e):
# Handle price out of range
pass
raise
Always implement exponential backoff and request queuing.
CONTRACTS = {
"CTF_EXCHANGE": "0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E",
"NEG_RISK_CTF_EXCHANGE": "0xC5d563A36AE7814Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
jwynia/agent-skills
mindrally/skills
github/awesome-copilot
kostja94/marketing-skills
wispbit-ai/skills
shubhamsaboo/awesome-llm-apps
polymarket-api fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Registry listing for polymarket-api matched our evaluation — installs cleanly and behaves as described in the markdown.
Useful defaults in polymarket-api — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
I recommend polymarket-api for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
polymarket-api is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Keeps context tight: polymarket-api is the kind of skill you can hand to a new teammate without a long onboarding doc.
polymarket-api has been reliable in day-to-day use. Documentation quality is above average for community skills.
Registry listing for polymarket-api matched our evaluation — installs cleanly and behaves as described in the markdown.
Registry listing for polymarket-api matched our evaluation — installs cleanly and behaves as described in the markdown.
polymarket-api reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 49