Skills

Polymarket API

Polymarket exchange mechanics, on-chain Polygon CTF, Gamma/CLOB/Data APIs, EIP-712...

Install

npx skills add agiprolabs/claude-trading-skills --skill polymarket-api -g -a claude-code -y
Category
Engineering
Updated
2mo ago
License
MIT
Context cost
Mediumabout 1,536 tokens
Runs scripts
No, instructions only

What it does

Polymarket exchange mechanics, on-chain Polygon CTF, Gamma/CLOB/Data APIs, EIP-712 auth, identifier model, WebSocket, settlement, and geo/KYC constraint

Polymarket API

Polymarket is a prediction market on Polygon mainnet. Every market is a pair of YES/NO ERC-1155 tokens issued by the Conditional Token Framework (CTF), collateralized 1:1 in USDC. Off-chain CLOB matching, on-chain settlement, zero taker fees. Prices are in [0.00, 1.00] USDC; YES + NO ≈ 1.0 per market.


Before you write any API code, read the live docs first.

Polymarket endpoints and auth flows have changed without notice. Prefer the official py-clob-client SDK over hand-rolled HTTP; it handles EIP-712 derivation, API credential management, and order signing. Only hand-roll when the SDK doesn't expose what you need.


Identifier model

You will juggle four distinct IDs, get them confused and queries silently return wrong data.

IDWhat it is
condition_idOn-chain hex ID of the market (the CTF condition)
clob_token_idsThe YES/NO pair of ERC-1155 token IDs, a two-element list
token_idA single outcome token, what you pass to order-book and WebSocket queries
event_idParent grouping (e.g. all brackets for "NYC high today")

Quick Start

1. Read markets, Gamma API (no auth required)

import httpx

# CRITICAL: default sort is OLDEST-first, always override or you silently get closed markets
events = httpx.get("https://gamma-api.polymarket.com/events", params={
    "tag_id": 103040,        # category tag (e.g. weather)
    "order": "endDate",
    "ascending": "false",    # must be string "false", not bool
    "closed": "false",
}).json()
Read the whole SKILL.md on GitHub

More in Engineering