web3-polymarket
Polymarket integration for prediction market trading on Polygon. Covers authentication (L1 EIP-712, L2 HMAC-SHA256, builder headers), order placement (GTC/GTD/FOK/FAK, batch, post-only, heartbeat), market data (Gamma API, Data API, orderbook, subgraph), WebSocket streaming (market/user/sports channe
By polymarket · 539 installs
npx skills add polymarket/agent-skills --skill web3-polymarket
Source repository · Upstream listing
Polymarket Skill
When to use this skill
Use this skill when the user asks about or needs to build:
Polymarket API authentication (L1/L2, API keys, HMAC signing)
Placing or managing orders (limit, market, GTC, GTD, FOK, FAK, batch, cancel)
Reading orderbook data (prices, spreads, midpoints, depth)
Market data fetching (events, markets, by slug, by tag, pagination)
WebSocket subscriptions (market channel, user channel, sports)
CTF operations (split, merge, redeem positions)
Negative risk markets (multi outcome, conversion, augmented neg risk)
Bridge operations (deposits, withdrawals, multi chain)
Gasless transactions (relayer client, order attribution)
Builder program integration (order attribution, API keys, tiers)
Polymarket SDK usage (TypeScript @polymarket/clob client, Python py clob client)
API Configuration
API Base URL Auth Purpose
CLOB https://clob.polymarket.com L2 for trade endpoints Orderbook, prices, order submission
Gamma / Data https://gamma api.polymarket.com None Events, markets, search
Data API https://data api.polymarket.com None Trades, positions, user data
WebSocket (Market) wss://ws subscriptions clob.polymarket.com/ws/market None Real time orderbook
WebSocket (User) wss://ws subscriptions clob.polymarket.com/ws/user API creds in message Trade/order updates
WebSocket (Sports) wss://sports api.polymarket.com/ws None Live scores
Relayer https://relayer v2.polymarket.com/ Builder headers Gasless transactions
Bridge https://bridge.polymarket.com None Deposits/withdrawals
Contract Addresses (Polygon)
Contract Address
USDC (USDC.e) 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
CTF (Conditional Tokens) 0x4D97DCd97eC945f40cF65F87097ACe5EA0476045
CTF Exchange 0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E
Neg Risk CTF Exchange 0xC5d563A36AE78145C45a50134d48A1215220f80a
Neg Risk Adapter 0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296
Client Setup
TypeScript
Python
Quick Reference: Order Types
Type Behavior Use Case
GTC Rests on book until filled or cancelled Default limit orders
GTD Active until expiration (UTC seconds). Min = now + 60 + N Auto expire before events
FOK Fill entirely immediately or cancel All or nothing market orders
FAK Fill what's available, cancel rest Partial fill market orders
FOK/FAK BUY: amount = dollar amount to spend
FOK/FAK SELL: amount = number of shares to sell
Post only: GTC/GTD only — rejected if would cross spread
Quick Reference: Signature Types
Type Value Description
EOA 0 Standard Ethereum wallet (MetaMask). Funder is the EOA address and will need POL for gas.
POLY PROXY 1 Custom proxy wallet for Magic Link email/Google users who exported PK from Polymarket.com.
GNOSIS SAFE 2 Gnosis Safe multisig proxy wallet (most common). Use for any new or returning user.
Core Pattern: Place an Order
TypeScript
Python
Core Pattern: Read Orderbook
TypeScript
Python
Core Pattern: WebSocket Subscribe
Reference files (load on demand)
Only read these when the task requires deeper detail on a specific topic:
Authentication (L1/L2, builder headers, credential lifecycle): [authentication.md](authentication.md)
Order patterns (GTC/GTD/FOK/FAK, tick sizes, cancel, heartbeat, errors): [order patterns.md](order patterns.md)
Market data (Gamma API, Data API, CLOB orderbook, subgraph): [market data.md](market data.md)
WebSocket (market/user/sports channels, subscribe, heartbeat): [websocket.md](websocket.md)
CTF operations (split, merge, redeem, neg risk, token IDs): [ctf operations.md](ctf operations.md)
Bridge (deposits, withdrawals, supported chains/tokens, status): [bridge.md](bridge.md)
Gasless transactions (relayer client, wallet deployment, builder setup): [gasless.md](gasless.md)