polymarket

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Polymarket — Prediction Market Data

Polymarket — 预测市场数据

Query prediction market data from Polymarket using their public REST APIs. All endpoints are read-only and require zero authentication.
See
references/api-endpoints.md
for the full endpoint reference with curl examples.
通过Polymarket的公开REST API查询预测市场数据。 所有端点均为只读,无需任何身份验证。
详见
references/api-endpoints.md
获取完整的端点参考及curl示例。

When to Use

使用场景

  • User asks about prediction markets, betting odds, or event probabilities
  • User wants to know "what are the odds of X happening?"
  • User asks about Polymarket specifically
  • User wants market prices, orderbook data, or price history
  • User asks to monitor or track prediction market movements
  • 用户询问预测市场、投注赔率或事件概率相关问题
  • 用户想了解“X发生的概率是多少?”
  • 用户专门询问Polymarket相关内容
  • 用户需要市场价格、订单簿数据或价格历史
  • 用户希望监控或追踪预测市场动态

Key Concepts

核心概念

  • Events contain one or more Markets (1:many relationship)
  • Markets are binary outcomes with Yes/No prices between 0.00 and 1.00
  • Prices ARE probabilities: price 0.65 means the market thinks 65% likely
  • outcomePrices
    field: JSON-encoded array like
    ["0.80", "0.20"]
  • clobTokenIds
    field: JSON-encoded array of two token IDs [Yes, No] for price/book queries
  • conditionId
    field: hex string used for price history queries
  • Volume is in USDC (US dollars)
  • Events包含一个或多个Markets(一对多关系)
  • Markets为二元结果,Yes/No价格介于0.00到1.00之间
  • 价格即概率:价格0.65意味着市场认为事件发生的可能性为65%
  • outcomePrices
    字段:JSON编码数组,例如
    ["0.80", "0.20"]
  • clobTokenIds
    字段:JSON编码的两个代币ID数组 [Yes, No],用于价格/订单簿查询
  • conditionId
    字段:十六进制字符串,用于价格历史查询
  • 交易量以USDC(美元)为单位

Three Public APIs

三个公开API

  1. Gamma API at
    gamma-api.polymarket.com
    — Discovery, search, browsing
  2. CLOB API at
    clob.polymarket.com
    — Real-time prices, orderbooks, history
  3. Data API at
    data-api.polymarket.com
    — Trades, open interest
  1. Gamma API,地址
    gamma-api.polymarket.com
    — 发现、搜索、浏览
  2. CLOB API,地址
    clob.polymarket.com
    — 实时价格、订单簿、历史数据
  3. Data API,地址
    data-api.polymarket.com
    — 交易记录、未平仓合约

Typical Workflow

典型工作流程

When a user asks about prediction market odds:
  1. Search using the Gamma API public-search endpoint with their query
  2. Parse the response — extract events and their nested markets
  3. Present market question, current prices as percentages, and volume
  4. Deep dive if asked — use clobTokenIds for orderbook, conditionId for history
当用户询问预测市场赔率时:
  1. 搜索:使用Gamma API的public-search端点执行用户查询
  2. 解析:处理响应结果 — 提取事件及其嵌套的市场信息
  3. 展示:呈现市场问题、当前价格(以百分比形式)及交易量
  4. 深入查询:若用户有需求,使用clobTokenIds查询订单簿,使用conditionId查询历史数据

Presenting Results

结果展示格式

Format prices as percentages for readability:
  • outcomePrices
    ["0.652", "0.348"]
    becomes "Yes: 65.2%, No: 34.8%"
  • Always show the market question and probability
  • Include volume when available
Example:
"Will X happen?" — 65.2% Yes ($1.2M volume)
将价格转换为百分比以提升可读性:
  • outcomePrices
    ["0.652", "0.348"]
    转换为“Yes: 65.2%, No: 34.8%”
  • 始终展示市场问题及概率
  • 如有可用,需包含交易量信息
示例:
"X会发生吗?" — Yes:65.2%(交易量120万美元)

Parsing Double-Encoded Fields

解析双重编码字段

The Gamma API returns
outcomePrices
,
outcomes
, and
clobTokenIds
as JSON strings inside JSON responses (double-encoded). When processing with Python, parse them with
json.loads(market['outcomePrices'])
to get the actual array.
Gamma API返回的
outcomePrices
outcomes
clobTokenIds
是JSON响应中的JSON字符串(双重编码)。使用Python处理时,需通过
json.loads(market['outcomePrices'])
解析以获取实际数组。

Rate Limits

速率限制

Generous — unlikely to hit for normal usage:
  • Gamma: 4,000 requests per 10 seconds (general)
  • CLOB: 9,000 requests per 10 seconds (general)
  • Data: 1,000 requests per 10 seconds (general)
限制较为宽松,正常使用下不太可能触发:
  • Gamma:每10秒4000次请求(通用)
  • CLOB:每10秒9000次请求(通用)
  • Data:每10秒1000次请求(通用)

Limitations

局限性

  • This skill is read-only — it does not support placing trades
  • Trading requires wallet-based crypto authentication (EIP-712 signatures)
  • Some new markets may have empty price history
  • Geographic restrictions apply to trading but read-only data is globally accessible
  • 本技能为只读模式 — 不支持下单交易
  • 交易需要基于钱包的加密货币身份验证(EIP-712签名)
  • 部分新市场可能没有价格历史数据
  • 交易存在地域限制,但只读数据全球可访问