polymarket-api
БесплатноБез исполняемых скриптовНе проверенDeep integration guide for Polymarket's CLOB API, Gamma API, and on-chain data. Use when building trading functionality, fetching market data, or implementing…
от agentmc15★ 26 звёзд на GitHubОб этом скилле
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/{condition_id} # Get specific market (condition_id is the
# MARKET key; token_id is the per-outcome
# BOOK key used by /price, /midpoint, /book
# below — the two are not interchangeable)
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
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
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
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 or cancelled
- GTD (Good Till Date): Expires at specified time
- FOK (Fill or Kill): Must fill entirely or cancel
- IOC (Immediate or Cancel): Fill what's available, cancel rest
Fee Model
Polymarket's taker-only formula (docs.polymarket.com/trading/fees, fetched 2026-09-04):
fee = C × rate × p × (1 − p)
Where:
C= contract count ($1 per contract at resolution)rate= taker fee rate (category-dependent, makers never pay)p= fill price, a probability in [0, 1](1 − p)= the fee term; maximized at p=0.5 (coin-flip), vanishes at tails (p→0 or p→1)
Category taker rates (charged in USDC):
| Category | Rate |
|---|---|
| Crypto | 0.07 |
| Sports / Economics / Culture / Weather / Other | 0.05 |
| Finance / Politics / Mentions / Tech | 0.04 |
| Geopolitics | 0.00 |
Per-market override: The CLOB market payload may carry maker_base_fee/taker_base_fee (historical field names), which is authoritative
Установить polymarket-api в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл polymarket-api?
Deep integration guide for Polymarket's CLOB API, Gamma API, and on-chain data. Use when building trading functionality, fetching market data, or implementing order execution.
Как установить скилл polymarket-api?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл polymarket-api запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic