Kalshi Agent Skill
CLI tool for trading prediction markets on Kalshi.
Installation
CODEBLOCK0
Configuration
- 1. Get API credentials at: https://kalshi.com/api
- Place your RSA private key at INLINECODE0
- Set your access key in
~/.kalshi/.env:
CODEBLOCK1
Or run kalshi setup-shell to add it to your shell config.
Commands
Browse & Research
CODEBLOCK2
Search Behavior
Search uses a multi-strategy approach:
- 1. Direct ticker lookup — tries the query as a market ticker, event ticker (
KX prefix), or series ticker - Series matching — dynamically searches all Kalshi series by title, category, and tags (e.g. "soccer" matches series tagged "Soccer")
- If many series match, shows an
interactive numbered list — enter a number to drill into that series' markets
- If few series match, fetches and displays markets directly
- 3. Market title search — falls back to searching open market titles/tickers
Common sport/category aliases are expanded automatically (e.g. "nfl" also searches "football").
Interactive Series Lists
Both kalshi search and kalshi series display numbered tables when listing series. After the table, you're prompted:
CODEBLOCK3
Pick a number to load that series' open markets inline. The prompt loops so you can explore multiple series without re-running the command.
Portfolio
CODEBLOCK4
Trading
CODEBLOCK5
Notes
- - Prices are in cents (68 = $0.68 = 68% implied probability)
- Prices display as both dollars and percentages (e.g.
$0.68 (68%)) - INLINECODE7 defaults to
yes if not specified - INLINECODE9 and
sell show a cost/proceeds summary and ask for confirmation (bypass with --force) - INLINECODE12 /
-m filters out markets where either side's bid is below a percentage threshold (default 0.5%) - INLINECODE14 /
-e sorts results by soonest expiry, adds an "Expires" column, and excludes already-expired entries - Expiry times are human-readable: "8h 35m", "Fri 04:00PM", "Apr 01", "Jan 01, 2027"
- Event tickers start with
KX (e.g. KXWO-GOLD-26); market tickers have more segments (e.g. KXWO-GOLD-26-NOR) - Market tables show outcome names (e.g. "Norway" instead of raw tickers) when available
API Reference
Full API docs: https://docs.kalshi.com/api-reference/
Kalshi Agent 技能
用于在 Kalshi 上进行预测市场交易的 CLI 工具。
安装
bash
npm install -g kalshi-cli
配置
- 1. 在 https://kalshi.com/api 获取 API 凭证
- 将你的 RSA 私钥放置在 ~/.kalshi/private_key.pem
- 在 ~/.kalshi/.env 中设置你的访问密钥:
KALSHIACCESSKEY=youraccesskey_id
或者运行 kalshi setup-shell 将其添加到你的 shell 配置中。
命令
浏览与研究
bash
列出开放市场(默认 20 个)
kalshi markets
kalshi markets -l 50
kalshi markets --status settled
按关键词、代码或类别搜索
kalshi search Super Bowl
kalshi search soccer
kalshi search hockey
kalshi search KXWO-GOLD-26
带筛选条件的搜索
kalshi search politics --min-odds 5 # 隐藏任意一方赔率低于 5% 的市场
kalshi search soccer --expiring # 按最早到期时间排序,显示到期列
kalshi search soccer -e -m 2 -l 20 # 组合标志:到期、2% 最低赔率、20 条结果
浏览所有活跃系列(交互式——选择一个编号进行深入查看)
kalshi series
kalshi series soccer
kalshi series --all # 包含没有活跃市场的系列
kalshi series -e # 按最早到期时间排序
查看单个市场详情
kalshi detail KXWO-GOLD-26-NOR
查看订单簿深度
kalshi orderbook KXWO-GOLD-26-NOR
搜索行为
搜索采用多策略方法:
- 1. 直接代码查找——将查询作为市场代码、事件代码(KX 前缀)或系列代码进行尝试
- 系列匹配——按标题、类别和标签动态搜索所有 Kalshi 系列(例如 soccer 匹配标记为 Soccer 的系列)
- 如果匹配多个系列,显示
交互式编号列表——输入一个编号以深入查看该系列的市场
- 如果匹配的系列较少,直接获取并显示市场
- 3. 市场标题搜索——回退到搜索开放市场的标题/代码
常见的运动/类别别名会自动扩展(例如 nfl 也会搜索 football)。
交互式系列列表
kalshi search 和 kalshi series 在列出系列时都会显示编号表格。表格之后,系统会提示:
输入编号以深入查看(或输入 q 退出):
选择一个编号以内联加载该系列的开放市场。提示会循环,因此你可以在不重新运行命令的情况下探索多个系列。
投资组合
bash
查看余额
kalshi balance
查看持仓
kalshi positions
查看未成交订单
kalshi orders
交易
bash
以每个 68 美分买入 10 份 YES 合约
kalshi buy KXSB-26 10 68
买入 NO 合约
kalshi buy KXWO-GOLD-26-NOR 5 32 --side no
卖出(相同语法)
kalshi sell KXWO-GOLD-26-NOR 5 40 --side no
跳过确认提示
kalshi buy KXSB-26 10 68 --force
取消未成交订单
kalshi cancel
说明
- - 价格以美分为单位(68 = $0.68 = 68% 隐含概率)
- 价格同时以美元和百分比显示(例如 $0.68 (68%))
- 如果未指定,--side 默认为 yes
- buy 和 sell 会显示成本/收益摘要并要求确认(使用 --force 跳过)
- --min-odds / -m 过滤掉任意一方出价低于百分比阈值(默认 0.5%)的市场
- --expiring / -e 按最早到期时间排序结果,添加到期列,并排除已过期的条目
- 到期时间以人类可读格式显示:8h 35m、Fri 04:00PM、Apr 01、Jan 01, 2027
- 事件代码以 KX 开头(例如 KXWO-GOLD-26);市场代码有更多段(例如 KXWO-GOLD-26-NOR)
- 市场表格在可用时显示结果名称(例如 Norway 而不是原始代码)
API 参考
完整 API 文档:https://docs.kalshi.com/api-reference/