polymarket
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePolymarket — Sports Prediction Markets
Polymarket — 体育预测市场
Setup
安装配置
Before first use, check if the CLI is available:
bash
which sports-skills || pip install sports-skillsIf fails with a Python version error, the package requires Python 3.10+. Find a compatible Python:
pip installbash
python3 --version # check version首次使用前,请检查CLI是否可用:
bash
which sports-skills || pip install sports-skills如果因Python版本错误失败,说明该包需要Python 3.10及以上版本。请找到兼容的Python版本:
pip installbash
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.
- (int, optional): Max results (default: 50, max: 100)
limit - (int, optional): Pagination offset
offset - (str, optional): Filter by type ("moneyline", "spreads", "totals")
sports_market_types - (str, optional): Filter by game
game_id - (bool, optional): Only active markets (default: true)
active - (bool, optional): Include closed markets (default: false)
closed - (str, optional): Sort field (default: "volume")
order - (bool, optional): Sort ascending (default: false)
ascending
获取活跃的体育预测市场。
- (整数,可选):最大结果数(默认:50,上限:100)
limit - (整数,可选):分页偏移量
offset - (字符串,可选):按类型筛选("moneyline", "spreads", "totals")
sports_market_types - (字符串,可选):按赛事筛选
game_id - (布尔值,可选):仅显示活跃市场(默认:true)
active - (布尔值,可选):包含已关闭市场(默认:false)
closed - (字符串,可选):排序字段(默认:"volume")
order - (布尔值,可选):升序排序(默认:false)
ascending
get_sports_events
get_sports_events
Get sports events (each groups related markets).
- ,
limit,offset,active,closed,order(same as above)ascending - (str, optional): Filter by series (league) ID
series_id
获取体育赛事(每组赛事关联相关市场)。
- ,
limit,offset,active,closed,order(参数与上述一致)ascending - (字符串,可选):按系列赛事(联赛)ID筛选
series_id
get_series
get_series
Get all series (leagues, recurring event groups).
- (int, optional): Max results (default: 100)
limit - (int, optional): Pagination offset
offset
获取所有系列赛事(联赛、固定赛事组)。
- (整数,可选):最大结果数(默认:100)
limit - (整数,可选):分页偏移量
offset
get_market_details
get_market_details
Get detailed info for a specific market.
- (str): Market ID
market_id - (str): Market slug (alternative to ID)
slug
获取特定市场的详细信息。
- (字符串):市场ID
market_id - (字符串):市场URL别名(替代ID)
slug
get_event_details
get_event_details
Get detailed info for a specific event.
- (str): Event ID
event_id - (str): Event slug (alternative to ID)
slug
获取特定赛事的详细信息。
- (字符串):赛事ID
event_id - (字符串):赛事URL别名(替代ID)
slug
get_market_prices
get_market_prices
Get current prices from the CLOB API.
- (str): Single CLOB token ID
token_id - (list): Multiple CLOB token IDs (batch)
token_ids
从CLOB API获取当前价格。
- (字符串):单个CLOB代币ID
token_id - (列表):多个CLOB代币ID(批量查询)
token_ids
get_order_book
get_order_book
Get full order book for a market.
- (str, required): CLOB token ID
token_id
获取市场的完整订单簿。
- (字符串,必填):CLOB代币ID
token_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".
- (str, optional): Keyword to search — use league names (e.g., "Premier League", "Champions League", "La Liga", "NBA Finals")
query - (str, optional): Filter by type
sports_market_types - (int, optional): Tag ID (default: 1 = Sports)
tag_id - (int, optional): Max results (default: 20)
limit
按关键词和筛选条件查找市场。搜索匹配赛事标题,而非体育类别。请使用具体联赛/赛事名称,而非“足球”或“橄榄球”等通用术语。
- (字符串,可选):搜索关键词——使用联赛名称(例如"Premier League", "Champions League", "La Liga", "NBA Finals")
query - (字符串,可选):按类型筛选
sports_market_types - (整数,可选):标签ID(默认:1 = 体育)
tag_id - (整数,可选):最大结果数(默认:20)
limit
get_price_history
get_price_history
Get historical price data.
- (str, required): CLOB token ID
token_id - (str, optional): Time range ("1d", "1w", "1m", "max"). Default: "max"
interval - (int, optional): Seconds between data points. Default: 120
fidelity
获取历史价格数据。
- (字符串,必填):CLOB代币ID
token_id - (字符串,可选):时间范围("1d", "1w", "1m", "max"),默认:"max"
interval - (整数,可选):数据点间隔秒数,默认:120
fidelity
get_last_trade_price
get_last_trade_price
Get the most recent trade price.
- (str, required): CLOB token ID
token_id
获取最新交易价格。
- (字符串,必填):CLOB代币ID
token_id
Examples
使用示例
User: "Who's favored to win the NBA Finals?"
- Call
search_markets(query="NBA Finals", sports_market_types="moneyline") - Get from the market details
token_id - Call for current odds
get_market_prices(token_id="...") - Present teams with implied probabilities (price = probability)
User: "Who will win the Premier League?"
- Call — use full league name
search_markets(query="English Premier League") - Sort results by Yes outcome price descending
- Present teams with implied probabilities (price = probability)
User: "Show me Champions League odds"
- Call
search_markets(query="Champions League") - Present top contenders with prices, volume, and liquidity
User: "What's the order book depth on this market?"
- Call for full book
get_order_book(token_id="...") - Present bids, asks, spread, and implied probabilities
用户:“谁更有可能赢得NBA总决赛?”
- 调用
search_markets(query="NBA Finals", sports_market_types="moneyline") - 从市场详情中获取
token_id - 调用获取当前赔率
get_market_prices(token_id="...") - 展示各球队的隐含概率(价格=概率)
用户:“谁会赢得英超联赛?”
- 调用——使用完整联赛名称
search_markets(query="English Premier League") - 按“Yes”结果价格降序排序
- 展示各球队的隐含概率(价格=概率)
用户:“展示欧冠赔率”
- 调用
search_markets(query="Champions League") - 展示热门球队的价格、交易量及流动性
用户:“这个市场的订单簿深度如何?”
- 调用获取完整订单簿
get_order_book(token_id="...") - 展示买盘、卖盘、点差及隐含概率
Troubleshooting
故障排除
- command not found: Package not installed. Run
sports-skills. If pip fails with a Python version error, you need Python 3.10+ — see Setup section.pip install sports-skills - : Same as above — install the package. Prefer the CLI over Python imports to avoid path issues.
ModuleNotFoundError: No module named 'sports_skills' - token_id vs market_id: Price/orderbook endpoints need the CLOB (found in market details under
token_id), not the GammaclobTokenIds. Always fetch market details first to get the token_id.market_id - Search returns 0 results: 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.
search_markets - Market not found by ID: Use with keywords instead of guessing IDs. Or use
search_markets(query="...")with the URL slug.get_market_details(slug="...") - Stale or wide prices: Low-liquidity markets may have wide bid-ask spreads. The price from
midis the midpoint — checkget_market_pricesto assess reliability.spread - Pagination: Use parameter for paging. Default
offsetvaries by endpoint (20-100). Increment offset by limit for each page.limit
- 命令未找到:未安装该包。运行
sports-skills。若pip因Python版本错误失败,需安装Python 3.10+版本——请查看安装配置部分。pip install sports-skills - :同上——安装该包。推荐使用CLI而非Python导入,以避免路径问题。
ModuleNotFoundError: No module named 'sports_skills' - token_id vs market_id:价格/订单簿端点需要CLOB的(可在市场详情的
token_id字段中找到),而非Gamma的clobTokenIds。请始终先获取市场详情以获取token_id。market_id - 搜索返回0条结果:匹配赛事标题,而非体育类别。请勿搜索“足球”或“橄榄球”——请按联赛名称搜索:“Premier League”, “Champions League”, “La Liga”, “Bundesliga”, “Serie A”, “NBA Finals”等。
search_markets - 通过ID无法找到市场:改用关键词搜索,而非猜测ID。或使用
search_markets(query="...")并传入URL别名。get_market_details(slug="...") - 价格过时或点差过大:低流动性市场的买卖点差可能较大。返回的
get_market_prices价格为中间价——请查看mid以评估可靠性。spread - 分页:使用参数进行分页。默认
offset因端点而异(20-100)。每次分页时将offset增加limit即可。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):价格、订单簿、交易数据。公开读取,无需身份验证。