kalshi
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKalshi — Prediction Markets
Kalshi — 预测市场
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 kalshi get_markets --series_ticker=KXNBA
sports-skills kalshi get_events --series_ticker=KXNBA --status=openPython SDK (alternative):
python
from sports_skills import kalshi
markets = kalshi.get_markets(series_ticker="KXNBA")
event = kalshi.get_event(event_ticker="KXNBA-26FEB14")优先使用CLI——可避免Python导入路径问题:
bash
sports-skills kalshi get_markets --series_ticker=KXNBA
sports-skills kalshi get_events --series_ticker=KXNBA --status=openPython SDK(替代方案):
python
from sports_skills import kalshi
markets = kalshi.get_markets(series_ticker="KXNBA")
event = kalshi.get_event(event_ticker="KXNBA-26FEB14")Commands
命令列表
get_exchange_status
get_exchange_status
Get exchange status (trading active, maintenance). No params.
获取交易所状态(交易是否活跃、是否维护中)。无参数。
get_exchange_schedule
get_exchange_schedule
Get exchange operating schedule. No params.
获取交易所运营时间表。无参数。
get_series_list
get_series_list
Get all available series.
- (str, optional): Filter by category
category - (str, optional): Filter by tags
tags
获取所有可用的系列产品。
- (字符串,可选):按类别筛选
category - (字符串,可选):按标签筛选
tags
get_series
get_series
Get details for a specific series.
- (str, required): Series ticker (see table below)
series_ticker
获取特定系列产品的详细信息。
- (字符串,必填):系列代码(见下方表格)
series_ticker
get_events
get_events
Get events with optional filtering.
- (int, optional): Max results (default: 100, max: 200)
limit - (str, optional): Pagination cursor
cursor - (str, optional): Filter by status ("open", "closed", "settled")
status - (str, optional): Filter by series ticker
series_ticker - (bool, optional): Include nested markets
with_nested_markets
获取赛事信息,支持可选筛选。
- (整数,可选):最大结果数(默认:100,上限:200)
limit - (字符串,可选):分页游标
cursor - (字符串,可选):按状态筛选("open"、"closed"、"settled")
status - (字符串,可选):按系列代码筛选
series_ticker - (布尔值,可选):包含嵌套市场
with_nested_markets
get_event
get_event
Get details for a specific event.
- (str, required): Event ticker
event_ticker - (bool, optional): Include nested markets
with_nested_markets
获取特定赛事的详细信息。
- (字符串,必填):赛事代码
event_ticker - (布尔值,可选):包含嵌套市场
with_nested_markets
get_markets
get_markets
Get markets with optional filtering.
- (int, optional): Max results (default: 100)
limit - (str, optional): Pagination cursor
cursor - (str, optional): Filter by event
event_ticker - (str, optional): Filter by series
series_ticker - (str, optional): Filter ("unopened", "open", "closed", "settled")
status - (str, optional): Comma-separated market tickers
tickers
获取交易市场信息,支持可选筛选。
- (整数,可选):最大结果数(默认:100)
limit - (字符串,可选):分页游标
cursor - (字符串,可选):按赛事筛选
event_ticker - (字符串,可选):按系列代码筛选
series_ticker - (字符串,可选):按状态筛选("unopened"、"open"、"closed"、"settled")
status - (字符串,可选):逗号分隔的市场代码
tickers
get_market
get_market
Get details for a specific market.
- (str, required): Market ticker
ticker
获取特定交易市场的详细信息。
- (字符串,必填):市场代码
ticker
get_trades
get_trades
Get recent trades.
- (int, optional): Max results (default: 100, max: 1000)
limit - (str, optional): Pagination cursor
cursor - (str, optional): Filter by market ticker
ticker - (int, optional): After Unix timestamp
min_ts - (int, optional): Before Unix timestamp
max_ts
获取近期交易记录。
- (整数,可选):最大结果数(默认:100,上限:1000)
limit - (字符串,可选):分页游标
cursor - (字符串,可选):按市场代码筛选
ticker - (整数,可选):仅返回该Unix时间戳之后的记录
min_ts - (整数,可选):仅返回该Unix时间戳之前的记录
max_ts
get_market_candlesticks
get_market_candlesticks
Get OHLC candlestick data.
- (str, required): Series ticker
series_ticker - (str, required): Market ticker
ticker - (int, required): Start Unix timestamp
start_ts - (int, required): End Unix timestamp
end_ts - (int, required): Interval in minutes (1, 60, or 1440)
period_interval
获取OHLC K线数据。
- (字符串,必填):系列代码
series_ticker - (字符串,必填):市场代码
ticker - (整数,必填):开始时间Unix时间戳
start_ts - (整数,必填):结束时间Unix时间戳
end_ts - (整数,必填):时间间隔(分钟),可选值为1、60或1440
period_interval
get_sports_filters
get_sports_filters
Get available sports filter categories. No params.
获取可用的体育项目筛选类别。无参数。
Common Series Tickers
常用系列代码
IMPORTANT: On Kalshi, "Football" = American Football (NFL). Soccer is under "Soccer".
| Sport | Series Ticker | Notes |
|---|---|---|
| NBA | | Games + futures |
| NFL | | Games + futures |
| MLB | | Games + futures |
| Champions League | | Futures (winner) |
| La Liga | | Futures (winner) |
| Bundesliga | | Futures (winner) |
| Serie A | | Futures (winner) |
| Ligue 1 | | Futures (winner) |
| FA Cup | | Futures |
| Europa League | | Futures |
| Conference League | | Futures |
Not all soccer leagues have futures/winner markets. EPL has match-day games but no title winner market. Use to discover all available competitions.
get_sports_filters()重要提示:在Kalshi平台,“Football”指美式橄榄球(NFL)。足球对应的是“Soccer”。
| 体育项目 | 系列代码 | 说明 |
|---|---|---|
| NBA | | 常规赛 + 期货 |
| NFL | | 常规赛 + 期货 |
| MLB | | 常规赛 + 期货 |
| 欧冠 | | 期货(冠军预测) |
| 西甲 | | 期货(冠军预测) |
| 德甲 | | 期货(冠军预测) |
| 意甲 | | 期货(冠军预测) |
| 法甲 | | 期货(冠军预测) |
| 足总杯 | | 期货 |
| 欧联杯 | | 期货 |
| 欧协联 | | 期货 |
并非所有足球联赛都设有冠军期货市场。英超有单场比赛市场,但没有冠军预测市场。可使用查询所有可用赛事。
get_sports_filters()Examples
示例
User: "What NBA markets are on Kalshi?"
- Call
get_events(series_ticker="KXNBA", status="open", with_nested_markets=True) - Present events with their nested markets, yes/no prices, and volume
User: "Who will win the Champions League?"
- Call
get_markets(series_ticker="KXUCL", status="open") - Sort by descending — price = implied probability (e.g., 20 = 20%)
last_price - Present top teams with ,
yes_sub_title, andlast_pricevolume
User: "Show me the price history for this NBA game"
- Get the market ticker from
get_markets(series_ticker="KXNBA") - Call
get_market_candlesticks(series_ticker="KXNBA", ticker="...", start_ts=..., end_ts=..., period_interval=60) - Present OHLC data with volume
用户:“Kalshi上有哪些NBA市场?”
- 调用
get_events(series_ticker="KXNBA", status="open", with_nested_markets=True) - 展示赛事及其嵌套市场、涨跌价格和交易量
用户:“谁会赢得欧冠冠军?”
- 调用
get_markets(series_ticker="KXUCL", status="open") - 按降序排序——价格代表隐含概率(例如:20 = 20%)
last_price - 展示排名靠前的球队及其、
yes_sub_title和last_pricevolume
用户:“给我展示这场NBA比赛的价格历史”
- 从中获取市场代码
get_markets(series_ticker="KXNBA") - 调用
get_market_candlesticks(series_ticker="KXNBA", ticker="...", start_ts=..., end_ts=..., period_interval=60) - 展示包含交易量的OHLC数据
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' - Empty market results: Use to filter for active markets. Default returns all statuses including settled/closed.
status="open" - Series ticker unknown: Check the Common Series Tickers table above. Use to discover categories, but note: "Football" = NFL, "Soccer" = football/soccer. Not all soccer leagues have futures markets.
get_sports_filters() - "Football" returned NFL, not soccer: Kalshi categorizes American Football as "Football" and soccer as "Soccer". Use ,
KXUCL, etc. for soccer — see tickers table.KXLALIGA - Pagination: Default limit is 100. If results are truncated, use the value from the response to fetch the next page.
cursor - Candlestick timestamps: and
start_tsmust be Unix timestamps (seconds).end_tsis in minutes: 1 (1-min), 60 (1-hour), or 1440 (1-day).period_interval
- 命令未找到:未安装该包。请运行
sports-skills。如果pip因Python版本错误失败,说明你需要Python 3.10+版本——请查看“设置”部分。pip install sports-skills - :同上——请安装该包。优先使用CLI而非Python导入,可避免路径问题。
ModuleNotFoundError: No module named 'sports_skills' - 返回空的市场结果:使用筛选活跃市场。默认会返回所有状态的市场,包括已结算/关闭的。
status="open" - 未知系列代码:请查看上方“常用系列代码”表格。可使用探索所有类别,但请注意:“Football”指NFL,“Soccer”指足球。并非所有足球联赛都有期货市场。
get_sports_filters() - 返回的“Football”是NFL而非足球:Kalshi将美式橄榄球归类为“Football”,足球归类为“Soccer”。足球相关请使用、
KXUCL等代码——见上方代码表格。KXLALIGA - 分页问题:默认结果上限为100条。如果结果被截断,请使用响应中的值获取下一页数据。
cursor - K线时间戳问题:和
start_ts必须为Unix时间戳(秒)。end_ts为分钟数:1(1分钟)、60(1小时)或1440(1天)。period_interval
API
API
- Base URL:
https://api.elections.kalshi.com/trade-api/v2 - All endpoints are public, read-only. No authentication required.
- 基础URL:
https://api.elections.kalshi.com/trade-api/v2 - 所有端点均为公开只读,无需身份验证。