agentleFS
OutsharpOutsharp/shipp-skills/skills/polymarket/SKILL.md

polymarket

Skill4 starsChanged 8 months agoApache-2.0View on GitHub

Polymarket is a decentralized prediction market platform built on Polygon. Use this skill to interact with the Polymarket APIs for market discovery, price data, order placement, portfolio management, WebSocket streaming, and bridging/withdrawals.

  • Reads credentials
  • Installs packages

23 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use heartmula, webhook-subscriptions and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • math-incSkill

    heartmula

    Set up and run HeartMuLa, the open-source music generation model family (Suno-like). Generates full songs from lyrics + tags with multilingual support.

    Also in 9 projects that use this

  • Tommy-ywSkill

    webhook-subscriptions

    Create and manage webhook subscriptions for event-driven agent activation, or for direct push notifications (zero LLM cost). Use when the user wants external services to trigger agent runs OR push notifications to chats.

    Also in 5 projects that use this

  • math-incSkill

    minecraft-modpack-server

    Set up a modded Minecraft server from a CurseForge/Modrinth server pack zip. Covers NeoForge/Forge install, Java version, JVM tuning, firewall, LAN config, backups, and launch scripts.

    Also in 5 projects that use this

  • john-data-chenSkill

    touchdesigner-mcp

    Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.

    Also in 5 projects that use this

  • TermiX-officialSkill

    hyperliquid

    Trade perpetual futures & spot on Hyperliquid DEX — market data, orders, positions, and vaults.

    Also in 3 projects that use this

  • mae616Skill

    p5js

    p5.js(クリエイティブコーディング)のProcessing由来「コードでスケッチ」思想を軸に、setup/drawループ・座標系・インタラクション・パフォーマンス最適化を整理する。p5.js、Processing、クリエイティブコーディング、ジェネラティブアート、インタラクティブ表現、ビジュアルプログラミング、Canvas描画、パーティクル、フラクタル、ノイズ表現に関する相談で必ず使うこと。ユーザーが「コードでアート」「動くビジュアル」「インタラクティブな描画」と言った場合にも適用する。

    Also in 8 projects that use this

  • +5 more from math-inc

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check this skill and the official documentation _FREQUENTLY_.

    line 40
  2. Very specific:

    Always consult llms.txt to discover every available page before building.

    line 44
  3. Distinctive:

    All detailed examples, request/response schemas, and walkthroughs live in the official docs.

    line 102
  4. Very specific:

    Use active=true&closed=false: when querying events to get only live, tradable markets.

    line 732
  5. Distinctive:

    Use the SDK: instead of signing manually — L1/L2 signing is complex (EIP-712 + HMAC-SHA256).

    line 735
  6. Distinctive:

    Authentication errors: Verify private key, signature type, funder address, and API credentials match.

    line 751
  7. Distinctive:

    Insufficient balance: Check funder address has enough USDCe or conditional tokens, including existing open order commitments.

    line 752

“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Polymarket API

Polymarket is a decentralized prediction market where users trade on the outcomes of real-world events. It uses a hybrid-decentralized Central Limit Order Book (CLOB) with off-chain matching and on-chain settlement on Polygon.

Check this skill and the official documentation FREQUENTLY. The canonical machine-readable index of all docs lives at:

https://docs.polymarket.com/llms.txt

Always consult llms.txt to discover every available page before building. It is the single source of truth for endpoint references, SDK docs, WebSocket channels, builder program details, and getting-started guides.


Key Concepts (Glossary)

TermDefinition
EventA collection of related markets grouped under a common topic (e.g., "2024 US Presidential Election").
MarketA single tradeable binary outcome within an event. Each market has Yes and No sides, a condition ID, question ID, and pair of token IDs.
TokenRepresents a position in a specific outcome (Yes or No). Prices range from 0.00 to 1.00. Winning tokens redeem for $1 USDCe. Also called outcome token.
Token IDThe unique identifier for a specific outcome token. Required when placing orders or querying prices.
Condition IDOn-chain identifier for a market's resolution condition. Used in CTF operations and as the market identifier in the CLOB.
Question IDIdentifier linking a market to its resolution oracle (UMA).
SlugHuman-readable URL identifier for a market or event (e.g., polymarket.com/event/[slug]).
CLOBCentral Limit Order Book — Polymarket's off-chain order matching system. Orders are matched here before on-chain settlement.
Tick SizeMinimum price increment for a market. Usually 0.01 (1 cent) or 0.001 (0.1 cent).
FillWhen an order is matched and executed. Orders can be partially or fully filled.
Negative Risk (NegRisk)A multi-outcome event where only one outcome can resolve Yes. Requires negRisk: true in order parameters.
CTFConditional Token Framework — the on-chain smart contracts that manage outcome tokens.
SplitConvert USDCe into a complete set of outcome tokens (one Yes + one No).
MergeConvert a complete set of outcome tokens back into USDCe.
RedeemAfter resolution, exchange winning tokens for $1 USDCe each.
USDCeBridged USDC on Polygon — the stablecoin used as collateral on Polymarket.
Funder AddressThe wallet address that holds funds and tokens for trading.
Signature TypeIdentifies wallet type: 0 = EOA, 1 = Magic Link proxy (POLY_PROXY), 2 = Gnosis Safe proxy.

Full glossary: https://docs.polymarket.com/quickstart/reference/glossary.md


Order Types

TypeNameDescription
GTCGood-Til-CancelledRemains open until filled or manually cancelled.
GTDGood-Til-DateExpires at a specified time if not filled.
FOKFill-Or-KillMust be filled entirely and immediately, or cancelled. No partial fills.
FAKFill-And-KillFills as much as possible immediately, then cancels any remaining unfilled portion.

Base URLs

APIBase URLDescription
CLOB APIhttps://clob.polymarket.comOrder management, prices, orderbooks, trading
Gamma APIhttps://gamma-api.polymarket.comMarket discovery, metadata, events, tags
Data APIhttps://data-api.polymarket.comUser positions, activity, trade history
CLOB WebSocketwss://ws-subscriptions-clob.polymarket.com/ws/Orderbook updates, order status
RTDS WebSocketwss://ws-live-data.polymarket.comLow-latency crypto prices, comments

Endpoints reference: https://docs.polymarket.com/quickstart/reference/endpoints.md


Documentation & References

All detailed examples, request/response schemas, and walkthroughs live in the official docs. Always consult these before building:

ResourceURL
Full documentation index (llms.txt)https://docs.polymarket.com/llms.txt
Developer Quickstarthttps://docs.polymarket.com/quickstart/overview.md
Fetching Market Datahttps://docs.polymarket.com/quickstart/fetching-data.md
Placing Your First Orderhttps://docs.polymarket.com/quickstart/first-order.md
API Rate Limitshttps://docs.polymarket.com/quickstart/introduction/rate-limits.md
Endpoints Referencehttps://docs.polymarket.com/quickstart/reference/endpoints.md
Glossaryhttps://docs.polymarket.com/quickstart/reference/glossary.md
CLOB Introductionhttps://docs.polymarket.com/developers/CLOB/introduction.md
Authenticationhttps://docs.polymarket.com/developers/CLOB/authentication.md
Client Methods Overviewhttps://docs.polymarket.com/developers/CLOB/clients/methods-overview.md
Public Methodshttps://docs.polymarket.com/developers/CLOB/clients/methods-public.md
L1 Methodshttps://docs.polymarket.com/developers/CLOB/clients/methods-l1.md
L2 Methodshttps://docs.polymarket.com/developers/CLOB/clients/methods-l2.md
Orders Overviewhttps://docs.polymarket.com/developers/CLOB/orders/orders.md
Place Single Orderhttps://docs.polymarket.com/developers/CLOB/orders/create-order.md
Place Multiple Ordershttps://docs.polymarket.com/developers/CLOB/orders/create-order-batch.md
Cancel Ordershttps://docs.polymarket.com/developers/CLOB/orders/cancel-orders.md
WebSocket Overviewhttps://docs.polymarket.com/developers/CLOB/websocket/wss-overview.md
Market Channelhttps://docs.polymarket.com/developers/CLOB/websocket/market-channel.md
User Channelhttps://docs.polymarket.com/developers/CLOB/websocket/user-channel.md
Gamma Structurehttps://docs.polymarket.com/developers/gamma-markets-api/gamma-structure.md
How to Fetch Marketshttps://docs.polymarket.com/developers/gamma-markets-api/fetch-markets-guide.md
Negative Risk Overviewhttps://docs.polymarket.com/developers/neg-risk/overview.md
CTF Overviewhttps://docs.polymarket.com/developers/CTF/overview.md
Builder Programhttps://docs.polymarket.com/developers/builders/builder-intro.md
Market Makers Introductionhttps://docs.polymarket.com/developers/market-makers/introduction.md
Bridge Overviewhttps://docs.polymarket.com/developers/misc-endpoints/bridge-overview.md
Polymarket Platformhttps://polymarket.com

Authentication

Polymarket uses a two-level authentication system. Public endpoints (market data, prices, orderbooks) require no authentication.

L1 Authentication (Private Key)

L1 uses the wallet's private key to sign an EIP-712 message. It proves ownership of the wallet and is used to create or derive L2 API credentials.

L1 Headers (for direct REST calls):

HeaderDescription
POLY_ADDRESSPolygon signer address
POLY_SIGNATUREEIP-712 signature
POLY_TIMESTAMPCurrent UNIX timestamp
POLY_NONCENonce (default 0)

The POLY_SIGNATURE is generated by signing an EIP-712 struct with domain ClobAuthDomain (version 1, chainId 137).

TypeScript example:

import { ClobClient } from "@polymarket/clob-client";
import { Wallet } from "ethers"; // v5.8.0

const HOST = "https://clob.polymarket.com";
const CHAIN_ID = 137; // Polygon mainnet
const signer = new Wallet(process.env.PRIVATE_KEY);

const client = new ClobClient(HOST, CHAIN_ID, signer);
const apiCreds = await client.createOrDeriveApiKey();
// Returns: { apiKey, secret, passphrase }

Python example:

from py_clob_client.client import ClobClient
import os

client = ClobClient(
    host="https://clob.polymarket.com",
    chain_id=137,
    key=os.getenv("PRIVATE_KEY"),
)
api_creds = client.create_or_derive_api_creds()
# Returns: { "apiKey": "...", "secret": "...", "passphrase": "..." }

Full L1 auth details: https://docs.polymarket.com/developers/CLOB/authentication.md

L2 Authentication (API Credentials)

L2 uses the API credentials (apiKey, secret, passphrase) derived from L1. Requests are signed with HMAC-SHA256 using the secret.

L2 Headers (for direct REST calls):

HeaderDescription
POLY_ADDRESSPolygon signer address
POLY_SIGNATUREHMAC-SHA256 signature
POLY_TIMESTAMPCurrent UNIX timestamp
POLY_API_KEYUser's API apiKey value
POLY_PASSPHRASEUser's API passphrase value

TypeScript example (full L2 client):

import { ClobClient } from "@polymarket/clob-client";
import { Wallet } from "ethers"; // v5.8.0

const signer = new Wallet(process.env.PRIVATE_KEY);
const apiCreds = {
  apiKey: process.env.API_KEY,
  secret: process.env.SECRET,
  passphrase: process.env.PASSPHRASE,
};

const client = new ClobClient(
  "https://clob.polymarket.com",
  137,
  signer,
  apiCreds,
  2,  // Signature type: 0=EOA, 1=POLY_PROXY, 2=GNOSIS_SAFE
  process.env.FUNDER_ADDRESS, // proxy wallet address
);

Python example (full L2 client):

from py_clob_client.client import ClobClient
from py_clob_client.clob_types import ApiCreds
import os

api_creds = ApiCreds(
    api_key=os.getenv("API_KEY"),
    api_secret=os.getenv("SECRET"),
    api_passphrase=os.getenv("PASSPHRASE"),
)

client = ClobClient(
    host="https://clob.polymarket.com",
    chain_id=137,
    key=os.getenv("PRIVATE_KEY"),
    creds=api_creds,
    signature_type=2,  # 0=EOA, 1=POLY_PROXY, 2=GNOSIS_SAFE
    funder=os.getenv("FUNDER_ADDRESS"),
)

Signature Types

TypeValueDescription
EOA0Standard Ethereum wallet. Funder is the EOA address. Needs POL for gas.
POLY_PROXY1Magic Link email/Google login proxy wallet. User must export PK from Polymarket.com.
GNOSIS_SAFE2Gnosis Safe multisig proxy wallet. Most common for Polymarket.com users.

Full auth guide: https://docs.polymarket.com/developers/CLOB/authentication.md


SDKs

Polymarket provides official SDKs. Prefer these for production integrations:

SDKInstallSource
TypeScriptnpm install @polymarket/clob-clientGitHub
Pythonpip install py-clob-clientGitHub
Rustcargo add polymarket-client-sdk—

For builders routing orders for users, also install:

PackageInstallPurpose
Builder Signing SDKnpm install @polymarket/builder-signing-sdkBuilder order attribution

Rate Limits

Polymarket uses Cloudflare-based throttling (requests are delayed, not immediately rejected). Key limits:

General

EndpointLimit
General Rate Limiting15,000 requests / 10s

Gamma API

EndpointLimit
Gamma (General)4,000 / 10s
/events500 / 10s
/markets300 / 10s
/markets & /events listing900 / 10s
Search350 / 10s
Tags200 / 10s
Comments200 / 10s

CLOB API

EndpointLimit
CLOB (General)9,000 / 10s
/book1,500 / 10s
/price1,500 / 10s
/midprice1,500 / 10s
/books, /prices, /midprices500 / 10s
Price History1,000 / 10s

CLOB Trading

EndpointBurst LimitSustained Limit
POST /order3,500 / 10s (500/s)36,000 / 10min (60/s)
DELETE /order3,000 / 10s (300/s)30,000 / 10min (50/s)
POST /orders (batch)1,000 / 10s (100/s)15,000 / 10min (25/s)
DELETE /orders (batch)1,000 / 10s (100/s)15,000 / 10min (25/s)
DELETE /cancel-all250 / 10s (25/s)6,000 / 10min (10/s)

Data API

EndpointLimit
Data API (General)1,000 / 10s
/trades200 / 10s
/positions150 / 10s
/closed-positions150 / 10s

Full rate limits: https://docs.polymarket.com/quickstart/introduction/rate-limits.md


REST API Endpoints Overview

Below is a summary organized by API. For full request/response schemas, see the linked docs or browse https://docs.polymarket.com/llms.txt.

Gamma API — Market Discovery & Metadata

Base: https://gamma-api.polymarket.com

EndpointMethodDescriptionDocs
/eventsGETList events (filter by active, closed, tag_id, series_id, etc.)List Events
/events/{id}GETGet event by IDGet Event by ID
/events/{slug}GETGet event by slugGet Event by Slug
/events/tagsGETGet event tagsGet Event Tags
/marketsGETList markets (filter by various criteria)List Markets
/markets/{id}GETGet market by IDGet Market by ID
/markets/{slug}GETGet market by slugGet Market by Slug
/tagsGETList tagsList Tags
/tags/{id}GETGet tag by IDGet Tag by ID
/tags/{slug}GETGet tag by slugGet Tag by Slug
/seriesGETList seriesList Series
/series/{id}GETGet series by IDGet Series by ID
/sportsGETGet sports metadataGet Sports Metadata
/sports/market-typesGETGet valid sports market typesGet Valid Sports Market Types
/teamsGETList teamsList Teams
/searchGETSearch markets, events, and profilesSearch
/commentsGETList commentsList Comments
/profiles/{address}GETGet public profile by wallet addressGet Profile

Gamma structure guide: https://docs.polymarket.com/developers/gamma-markets-api/gamma-structure.md

CLOB API — Pricing & Orderbooks (Public)

Base: https://clob.polymarket.com

EndpointMethodAuthDescriptionDocs
/priceGETNoGet current price for a token and sideGet Market Price
/pricesPOSTNoGet prices for multiple tokens and sidesGet Multiple Market Prices
/midpointGETNoGet midpoint price for a tokenGet Midpoint Price
/bookGETNoGet order book for a tokenGet Order Book Summary
/booksPOSTNoGet order books for multiple tokensGet Multiple Order Books
/prices-historyGETNoGet historical price data for a tokenGet Price History
/spreadsGETNoGet bid-ask spreads for multiple tokensGet Bid-Ask Spreads

CLOB API — Trading (Authenticated)

Base: https://clob.polymarket.com

EndpointMethodAuthDescriptionDocs
/orderPOSTL2Place a single orderPlace Single Order
/orderDELETEL2Cancel a single orderCancel Orders
/ordersPOSTL2Place multiple orders (batch, up to 15)Place Multiple Orders
/ordersDELETEL2Cancel multiple ordersCancel Orders
/cancel-allDELETEL2Cancel all open ordersCancel Orders
/cancel-market-ordersDELETEL2Cancel all orders for a specific marketCancel Orders

CLOB API — Orders & Trades (Authenticated)

EndpointMethodAuthDescriptionDocs
/data/order/{orderId}GETL2Get a specific orderGet Order
/data/ordersGETL2Get active/open ordersGet Active Orders
/data/tradesGETL2Get user's tradesGet Trades
/order/scoringGETL2Check order reward scoring eligibilityCheck Scoring

CLOB API — Auth Endpoints

EndpointMethodAuthDescription
/auth/api-keyPOSTL1Create new API credentials
/auth/derive-api-keyGETL1Derive existing API credentials
/auth/api-keysGETL2List API keys
/auth/api-keyDELETEL2Delete/revoke an API key

Data API — Positions & Activity

Base: https://data-api.polymarket.com

EndpointMethodDescriptionDocs
/positionsGETGet current positions for a userGet Current Positions
/closed-positionsGETGet closed positions for a userGet Closed Positions
/positions/marketGETGet positions for a marketGet Positions for Market
/positions/valueGETGet total value of a user's positionsGet Total Value
/top-holdersGETGet top holders for marketsGet Top Holders
/tradesGETGet trades for a user or marketsGet Trades
/activityGETGet user on-chain activityGet User Activity
/leaderboardGETGet trader leaderboard rankingsGet Leaderboard
/open-interestGETGet open interestGet Open Interest
/volumeGETGet live volume for an eventGet Live Volume

Bridge API — Deposits & Withdrawals

EndpointMethodDescriptionDocs
/depositPOSTCreate deposit addressesCreate Deposit Addresses
/withdrawPOSTCreate withdrawal addressesCreate Withdrawal Addresses
/supported-assetsGETGet supported chains & tokensGet Supported Assets
/quoteGETGet deposit/withdrawal quoteGet a Quote
/statusGETGet transaction statusGet Transaction Status

Bridge overview: https://docs.polymarket.com/developers/misc-endpoints/bridge-overview.md

Builder Program Endpoints

EndpointMethodDescriptionDocs
/builders/leaderboardGETGet aggregated builder leaderboardBuilder Leaderboard
/builders/volumeGETGet daily builder volume time-seriesBuilder Volume

Builder program: https://docs.polymarket.com/developers/builders/builder-intro.md


Fees

Current fee schedule (subject to change):

Volume LevelMaker Fee (bps)Taker Fee (bps)
>0 USDC00

Fee calculation depends on buying vs. selling:

  • Selling outcome tokens: feeQuote = baseRate × min(price, 1 - price) × size
  • Buying outcome tokens: feeBase = baseRate × min(price, 1 - price) × (size / price)

Fees details: https://docs.polymarket.com/developers/CLOB/introduction.md

Maker rebates program: https://docs.polymarket.com/developers/market-makers/maker-rebates-program.md


WebSocket API

Polymarket provides two WebSocket services for real-time data.

CLOB WebSocket

wss://ws-subscriptions-clob.polymarket.com/ws/

Two channels are available:

ChannelAuth RequiredDescriptionDocs
marketNoOrderbook and price updates (public)Market Channel
userYesOrder status and trade updatesUser Channel

Market Channel Events

Event TypeTriggerDescription
bookFirst subscribe / tradeFull orderbook snapshot with bids and asks
price_changeNew order / cancellationIncremental price level changes with best bid/ask
tick_size_changePrice > 0.96 or < 0.04Minimum tick size update
last_trade_priceTrade matchLast trade price, side, and size
best_bid_askBest price changeBest bid, ask, and spread (requires custom_feature_enabled)
new_marketMarket createdNew market details (requires custom_feature_enabled)
market_resolvedMarket resolvedResolution details with winning outcome (requires custom_feature_enabled)

User Channel Events

Event TypeTriggerDescription
tradeOrder matched / status changeTrade details with maker orders, status (MATCHED, MINED, CONFIRMED, RETRYING, FAILED)
orderOrder placed / updated / cancelledOrder details with type (PLACEMENT, UPDATE, CANCELLATION)

Subscription

Send a JSON message upon connection:

{
  "auth": { /* L2 auth for user channel */ },
  "markets": ["0x...conditionId"],
  "assets_ids": ["tokenId1", "tokenId2"],
  "type": "market",
  "custom_feature_enabled": true
}

Subscribe/unsubscribe to additional assets after connecting:

{
  "assets_ids": ["tokenId3"],
  "markets": [],
  "operation": "subscribe",
  "custom_feature_enabled": true
}

Full WebSocket guide: https://docs.polymarket.com/developers/CLOB/websocket/wss-overview.md WSS Authentication: https://docs.polymarket.com/developers/CLOB/websocket/wss-auth.md

RTDS (Real-Time Data Stream)

wss://ws-live-data.polymarket.com

Low-latency streaming for crypto prices and comment feeds. Optimized for market makers.

Sports WebSocket

Real-time sports results via WebSocket:


Data Model

Event → Market → Token Hierarchy

Event (e.g., "Who will win the 2024 election?")
├── Market 1 (e.g., "Will Candidate A win?")
│   ├── Token: Yes (token_id: "abc...")  price: 0.65
│   └── Token: No  (token_id: "def...")  price: 0.35
├── Market 2 (e.g., "Will Candidate B win?")
│   ├── Token: Yes (token_id: "ghi...")  price: 0.30
│   └── Token: No  (token_id: "jkl...")  price: 0.70
└── ...
  • Prices are implied probabilities (0.00–1.00). Yes + No prices sum to ≈ $1.
  • clobTokenIds from the Gamma API map to CLOB token IDs needed for trading.
  • outcomes and outcomePrices arrays are 1:1 mapped.

Negative Risk Events

Multi-outcome events where only one outcome can resolve "Yes" use the negative risk architecture. A NO share in any market can be converted into 1 YES share in all other markets, enabling capital efficiency.

  • negRisk: true on the event indicates negative risk.
  • negRiskAugmented: true means placeholder outcomes can be clarified later.

Full NegRisk docs: https://docs.polymarket.com/developers/neg-risk/overview.md


Common Patterns

Fetch Active Events

curl -s "https://gamma-api.polymarket.com/events?active=true&closed=false&limit=10" | jq '.[].title'

Get Event Details with Markets

curl -s "https://gamma-api.polymarket.com/events?slug=will-bitcoin-reach-100k-by-2025" | jq '.[0] | {title, markets: [.markets[] | {question, outcomePrices, clobTokenIds}]}'

Get Current Price for a Token

curl -s "https://clob.polymarket.com/price?token_id=YOUR_TOKEN_ID&side=buy"
# Returns: { "price": "0.65" }

Get Orderbook Depth

curl -s "https://clob.polymarket.com/book?token_id=YOUR_TOKEN_ID" | jq '{bids: .bids[:3], asks: .asks[:3]}'

Get Midpoint Price

curl -s "https://clob.polymarket.com/midpoint?token_id=YOUR_TOKEN_ID"
# Returns: { "mid": "0.655" }

Search for Markets

curl -s "https://gamma-api.polymarket.com/search?query=bitcoin&limit=5" | jq '.markets[] | {question, slug}'

Discover Sports Markets

# Get all supported sports leagues
curl -s "https://gamma-api.polymarket.com/sports" | jq '.'

# Get NBA events
curl -s "https://gamma-api.polymarket.com/events?series_id=10345&active=true&closed=false" | jq '.[].title'

Get User Positions (Data API)

curl -s "https://data-api.polymarket.com/positions?user=0xYOUR_ADDRESS" | jq '.'

Place an Order (TypeScript)

import { ClobClient, Side, OrderType } from "@polymarket/clob-client";
import { Wallet } from "ethers";

const client = new ClobClient(
  "https://clob.polymarket.com", 137, signer, apiCreds, 2, funderAddress
);

const market = await client.getMarket("CONDITION_ID");
const response = await client.createAndPostOrder(
  { tokenID: "TOKEN_ID", price: 0.50, size: 10, side: Side.BUY },
  { tickSize: market.tickSize, negRisk: market.negRisk },
  OrderType.GTC
);
console.log("Order ID:", response.orderID);

Place an Order (Python)

from py_clob_client.client import ClobClient
from py_clob_client.clob_types import OrderArgs, OrderType
from py_clob_client.order_builder.constants import BUY

market = client.get_market("CONDITION_ID")
response = client.create_and_post_order(
    OrderArgs(token_id="TOKEN_ID", price=0.50, size=10, side=BUY),
    options={"tick_size": market["tickSize"], "neg_risk": market["negRisk"]},
    order_type=OrderType.GTC,
)
print("Order ID:", response["orderID"])

CTF Operations (Split / Merge / Redeem)

The Conditional Token Framework enables conversion between USDCe and outcome tokens:

OperationDescriptionWhen to Use
SplitUSDCe → 1 Yes token + 1 No tokenCreate inventory for market making
Merge1 Yes token + 1 No token → USDCeExit positions, reclaim collateral
RedeemWinning token → $1 USDCeAfter market resolution

Builder Program

Builders are third-party developers who integrate Polymarket into their apps. The program offers permissionless integration with tiered rate limits, rewards, and revenue opportunities.

Builder credentials are separate from user credentials. You use builder credentials to tag/attribute orders, but each user still needs their own L2 credentials to trade.


Market Making


Usage Tips

  • Always check llms.txt first: https://docs.polymarket.com/llms.txt has every endpoint and guide.
  • Never hardcode private keys — use environment variables or secure key storage.
  • Prices are probabilities (0.00–1.00). Winning tokens redeem at $1 USDCe.
  • Use active=true&closed=false when querying events to get only live, tradable markets.
  • Token IDs come from Gamma — fetch events/markets from Gamma API, then use clobTokenIds for CLOB queries and trading.
  • Set negRisk correctly — multi-outcome events use negative risk. Check the event's negRisk field and pass it when creating orders.
  • Use the SDK instead of signing manually — L1/L2 signing is complex (EIP-712 + HMAC-SHA256). The TypeScript and Python clients handle this.
  • Allowances must be set — before placing orders, the funder address must have USDCe allowance set for the Exchange contract (buying) or conditional token allowance (selling).
  • Combine REST + WebSocket — use REST for initial state and WebSocket for real-time deltas.
  • Respect rate limits — implement backoff when throttled. Use batch endpoints (/books, /prices) to reduce request count.
  • Signature type matters — type 0 (EOA) for standalone wallets, type 2 (Gnosis Safe) for most Polymarket.com accounts. Incorrect type will cause auth failures.
  • Funder ≠ Signer for proxy wallets — the funder is the proxy wallet address (visible at polymarket.com/settings), not the private key's EOA address.
  • Geographic restrictions apply — check https://docs.polymarket.com/developers/CLOB/geoblock.md before trading.
  • Order validity is continuously monitored — balances, allowances, and on-chain cancellations are checked in real time. Abuse leads to blacklisting.

Error Handling

Standard HTTP error codes apply. The API returns JSON error bodies with descriptive messages.

  • Throttled requests (rate limited): Requests are delayed/queued, not immediately rejected. Implement backoff.
  • Authentication errors: Verify private key, signature type, funder address, and API credentials match.
  • Insufficient balance: Check funder address has enough USDCe or conditional tokens, including existing open order commitments.
  • Order rejected: Max order size = balance - sum(openOrderSize - fillAmount) per market.
  • Geographic restriction: Trading blocked from restricted regions.

Resolution

Markets are resolved by the UMA Optimistic Oracle, a smart-contract-based optimistic oracle. Resolution can be disputed via the UMA protocol.


On-Chain Resources

ResourceURL
Exchange contract sourceGitHub
Exchange contract docsGitHub
Security audit (Chainsecurity)Audit PDF
Negative Risk AdapterPolygonscan
Subgraph overviewhttps://docs.polymarket.com/developers/subgraph/overview.md
Blockchain data resourceshttps://docs.polymarket.com/developers/builders/blockchain-data-resources.md
USDC on Polygon0x2791bca1f2de4661ed88a30c99a7a9449aa84174

Changelog

Monitor the Polymarket Changelog for updates to the CLOB, API, UI, and mobile applications.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.