polymarket

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Polymarket — Sports Prediction Markets

Polymarket — 体育预测市场

Setup

安装配置

Before first use, check if the CLI is available:
bash
which sports-skills || pip install sports-skills
If
pip install
fails with a Python version error, the package requires Python 3.10+. Find a compatible Python:
bash
python3 --version  # check version
首次使用前,请检查CLI是否可用:
bash
which sports-skills || pip install sports-skills
如果
pip install
因Python版本错误失败,说明该包需要Python 3.10及以上版本。请找到兼容的Python版本:
bash
python3 --version  # 检查版本

If < 3.10, try: python3.12 -m pip install sports-skills

若版本低于3.10,尝试:python3.12 -m pip install sports-skills

On macOS with Homebrew: /opt/homebrew/bin/python3.12 -m pip install sports-skills

在使用Homebrew的macOS上:/opt/homebrew/bin/python3.12 -m pip install sports-skills

No API keys required.
无需API密钥。

Quick Start

快速开始

Prefer the CLI — it avoids Python import path issues:
bash
sports-skills polymarket get_sports_markets --limit=20
sports-skills polymarket search_markets --query="NBA Finals"
Python SDK (alternative):
python
from sports_skills import polymarket

markets = polymarket.get_sports_markets(limit=20)
prices = polymarket.get_market_prices(token_id="abc123")
推荐使用CLI——可避免Python导入路径问题:
bash
sports-skills polymarket get_sports_markets --limit=20
sports-skills polymarket search_markets --query="NBA Finals"
Python SDK(替代方案):
python
from sports_skills import polymarket

markets = polymarket.get_sports_markets(limit=20)
prices = polymarket.get_market_prices(token_id="abc123")

Commands

命令说明

get_sports_markets

get_sports_markets

Get active sports prediction markets.
  • limit
    (int, optional): Max results (default: 50, max: 100)
  • offset
    (int, optional): Pagination offset
  • sports_market_types
    (str, optional): Filter by type ("moneyline", "spreads", "totals")
  • game_id
    (str, optional): Filter by game
  • active
    (bool, optional): Only active markets (default: true)
  • closed
    (bool, optional): Include closed markets (default: false)
  • order
    (str, optional): Sort field (default: "volume")
  • ascending
    (bool, optional): Sort ascending (default: false)
获取活跃的体育预测市场。
  • limit
    (整数,可选):最大结果数(默认:50,上限:100)
  • offset
    (整数,可选):分页偏移量
  • sports_market_types
    (字符串,可选):按类型筛选("moneyline", "spreads", "totals")
  • game_id
    (字符串,可选):按赛事筛选
  • active
    (布尔值,可选):仅显示活跃市场(默认:true)
  • closed
    (布尔值,可选):包含已关闭市场(默认:false)
  • order
    (字符串,可选):排序字段(默认:"volume")
  • ascending
    (布尔值,可选):升序排序(默认:false)

get_sports_events

get_sports_events

Get sports events (each groups related markets).
  • limit
    ,
    offset
    ,
    active
    ,
    closed
    ,
    order
    ,
    ascending
    (same as above)
  • series_id
    (str, optional): Filter by series (league) ID
获取体育赛事(每组赛事关联相关市场)。
  • limit
    ,
    offset
    ,
    active
    ,
    closed
    ,
    order
    ,
    ascending
    (参数与上述一致)
  • series_id
    (字符串,可选):按系列赛事(联赛)ID筛选

get_series

get_series

Get all series (leagues, recurring event groups).
  • limit
    (int, optional): Max results (default: 100)
  • offset
    (int, optional): Pagination offset
获取所有系列赛事(联赛、固定赛事组)。
  • limit
    (整数,可选):最大结果数(默认:100)
  • offset
    (整数,可选):分页偏移量

get_market_details

get_market_details

Get detailed info for a specific market.
  • market_id
    (str): Market ID
  • slug
    (str): Market slug (alternative to ID)
获取特定市场的详细信息。
  • market_id
    (字符串):市场ID
  • slug
    (字符串):市场URL别名(替代ID)

get_event_details

get_event_details

Get detailed info for a specific event.
  • event_id
    (str): Event ID
  • slug
    (str): Event slug (alternative to ID)
获取特定赛事的详细信息。
  • event_id
    (字符串):赛事ID
  • slug
    (字符串):赛事URL别名(替代ID)

get_market_prices

get_market_prices

Get current prices from the CLOB API.
  • token_id
    (str): Single CLOB token ID
  • token_ids
    (list): Multiple CLOB token IDs (batch)
从CLOB API获取当前价格。
  • token_id
    (字符串):单个CLOB代币ID
  • token_ids
    (列表):多个CLOB代币ID(批量查询)

get_order_book

get_order_book

Get full order book for a market.
  • token_id
    (str, required): CLOB token ID
获取市场的完整订单簿。
  • token_id
    (字符串,必填):CLOB代币ID

get_sports_market_types

get_sports_market_types

Get all valid sports market types. No params.
获取所有有效的体育市场类型,无参数。

search_markets

search_markets

Find markets by keyword and filters. Search matches event titles, not sport categories. Use specific league/competition names, not generic terms like "soccer" or "football".
  • query
    (str, optional): Keyword to search — use league names (e.g., "Premier League", "Champions League", "La Liga", "NBA Finals")
  • sports_market_types
    (str, optional): Filter by type
  • tag_id
    (int, optional): Tag ID (default: 1 = Sports)
  • limit
    (int, optional): Max results (default: 20)
按关键词和筛选条件查找市场。搜索匹配赛事标题,而非体育类别。请使用具体联赛/赛事名称,而非“足球”或“橄榄球”等通用术语。
  • query
    (字符串,可选):搜索关键词——使用联赛名称(例如"Premier League", "Champions League", "La Liga", "NBA Finals")
  • sports_market_types
    (字符串,可选):按类型筛选
  • tag_id
    (整数,可选):标签ID(默认:1 = 体育)
  • limit
    (整数,可选):最大结果数(默认:20)

get_price_history

get_price_history

Get historical price data.
  • token_id
    (str, required): CLOB token ID
  • interval
    (str, optional): Time range ("1d", "1w", "1m", "max"). Default: "max"
  • fidelity
    (int, optional): Seconds between data points. Default: 120
获取历史价格数据。
  • token_id
    (字符串,必填):CLOB代币ID
  • interval
    (字符串,可选):时间范围("1d", "1w", "1m", "max"),默认:"max"
  • fidelity
    (整数,可选):数据点间隔秒数,默认:120

get_last_trade_price

get_last_trade_price

Get the most recent trade price.
  • token_id
    (str, required): CLOB token ID
获取最新交易价格。
  • token_id
    (字符串,必填):CLOB代币ID

Examples

使用示例

User: "Who's favored to win the NBA Finals?"
  1. Call
    search_markets(query="NBA Finals", sports_market_types="moneyline")
  2. Get
    token_id
    from the market details
  3. Call
    get_market_prices(token_id="...")
    for current odds
  4. Present teams with implied probabilities (price = probability)
User: "Who will win the Premier League?"
  1. Call
    search_markets(query="English Premier League")
    — use full league name
  2. Sort results by Yes outcome price descending
  3. Present teams with implied probabilities (price = probability)
User: "Show me Champions League odds"
  1. Call
    search_markets(query="Champions League")
  2. Present top contenders with prices, volume, and liquidity
User: "What's the order book depth on this market?"
  1. Call
    get_order_book(token_id="...")
    for full book
  2. Present bids, asks, spread, and implied probabilities
用户:“谁更有可能赢得NBA总决赛?”
  1. 调用
    search_markets(query="NBA Finals", sports_market_types="moneyline")
  2. 从市场详情中获取
    token_id
  3. 调用
    get_market_prices(token_id="...")
    获取当前赔率
  4. 展示各球队的隐含概率(价格=概率)
用户:“谁会赢得英超联赛?”
  1. 调用
    search_markets(query="English Premier League")
    ——使用完整联赛名称
  2. 按“Yes”结果价格降序排序
  3. 展示各球队的隐含概率(价格=概率)
用户:“展示欧冠赔率”
  1. 调用
    search_markets(query="Champions League")
  2. 展示热门球队的价格、交易量及流动性
用户:“这个市场的订单簿深度如何?”
  1. 调用
    get_order_book(token_id="...")
    获取完整订单簿
  2. 展示买盘、卖盘、点差及隐含概率

Troubleshooting

故障排除

  • sports-skills
    command not found
    : Package not installed. Run
    pip install sports-skills
    . If pip fails with a Python version error, you need Python 3.10+ — see Setup section.
  • ModuleNotFoundError: No module named 'sports_skills'
    : Same as above — install the package. Prefer the CLI over Python imports to avoid path issues.
  • token_id vs market_id: Price/orderbook endpoints need the CLOB
    token_id
    (found in market details under
    clobTokenIds
    ), not the Gamma
    market_id
    . Always fetch market details first to get the token_id.
  • Search returns 0 results:
    search_markets
    matches event titles, not sport categories. Don't search "soccer" or "football" — search by league name: "Premier League", "Champions League", "La Liga", "Bundesliga", "Serie A", "NBA Finals", etc.
  • Market not found by ID: Use
    search_markets(query="...")
    with keywords instead of guessing IDs. Or use
    get_market_details(slug="...")
    with the URL slug.
  • Stale or wide prices: Low-liquidity markets may have wide bid-ask spreads. The
    mid
    price from
    get_market_prices
    is the midpoint — check
    spread
    to assess reliability.
  • Pagination: Use
    offset
    parameter for paging. Default
    limit
    varies by endpoint (20-100). Increment offset by limit for each page.
  • sports-skills
    命令未找到
    :未安装该包。运行
    pip install sports-skills
    。若pip因Python版本错误失败,需安装Python 3.10+版本——请查看安装配置部分。
  • ModuleNotFoundError: No module named 'sports_skills'
    :同上——安装该包。推荐使用CLI而非Python导入,以避免路径问题。
  • token_id vs market_id:价格/订单簿端点需要CLOB的
    token_id
    (可在市场详情的
    clobTokenIds
    字段中找到),而非Gamma的
    market_id
    。请始终先获取市场详情以获取token_id。
  • 搜索返回0条结果
    search_markets
    匹配赛事标题,而非体育类别。请勿搜索“足球”或“橄榄球”——请按联赛名称搜索:“Premier League”, “Champions League”, “La Liga”, “Bundesliga”, “Serie A”, “NBA Finals”等。
  • 通过ID无法找到市场:改用
    search_markets(query="...")
    关键词搜索,而非猜测ID。或使用
    get_market_details(slug="...")
    并传入URL别名。
  • 价格过时或点差过大:低流动性市场的买卖点差可能较大。
    get_market_prices
    返回的
    mid
    价格为中间价——请查看
    spread
    以评估可靠性。
  • 分页:使用
    offset
    参数进行分页。默认
    limit
    因端点而异(20-100)。每次分页时将offset增加limit即可。

APIs

API说明

  • Gamma API (gamma-api.polymarket.com): Market metadata, events, series. Public, no auth.
  • CLOB API (clob.polymarket.com): Prices, order books, trades. Public reads, no auth.
  • Gamma API(gamma-api.polymarket.com):市场元数据、赛事、系列赛事。公开访问,无需身份验证。
  • CLOB API(clob.polymarket.com):价格、订单簿、交易数据。公开读取,无需身份验证。