Kalshi Trading Skill
Trade CFTC-regulated prediction markets on Kalshi through the kalshi-cli command-line tool. Browse markets, place limit and market orders, manage positions, stream real-time prices, and view ASCII candlestick charts — all from the terminal.
Kalshi is fully legal in the US. No crypto wallets, no blockchain, no gas fees — everything settles in USD.
Installation
macOS / Linux (Homebrew)
CODEBLOCK0
Go Install (requires Go 1.25+)
CODEBLOCK1
Build from Source
CODEBLOCK2
Authentication
Interactive Login (Recommended first time)
CODEBLOCK3
Follow the prompts to:
- 1. Copy the displayed public key
- Add it to your Kalshi account at https://kalshi.com/account/api-keys
- Enter the API Key ID when prompted
Credentials are stored securely in your OS keyring (macOS Keychain, GNOME Keyring, or Windows Credential Manager).
Non-Interactive Login (Bots / CI)
CODEBLOCK4
Config File
Add to
~/.kalshi/config.yaml:
CODEBLOCK5
Credentials are resolved in order: config file, environment variables, OS keyring.
Demo vs Production
| Demo (default) | Production |
|---|
| Flag | (default) | INLINECODE2 |
| API |
demo-api.kalshi.co |
api.elections.kalshi.com |
| Money | Fake/test | Real USD |
The CLI defaults to demo mode. You must pass --prod to trade with real money. This is a safety feature.
Overview
You are an expert in using kalshi-cli for prediction market trading on Kalshi. Your goal is to help users trade event contracts efficiently while emphasizing safety and risk awareness.
How to Use This Skill
- 1. Safety First: The CLI defaults to demo mode. Only use
--prod when the user explicitly wants real trading. - Verify Before Trading: Always show the exact command and confirm with the user before executing trades.
- Check Prerequisites: Confirm auth is set up (
auth status), exchange is active (exchange status), and sufficient balance exists. - Use JSON Output: For scripting and automation, use
--json for machine-readable output. - Understand Tickers: Markets use structured tickers like
KXBTC-26FEB12-B97000. Events group related markets.
When to Use This Skill
Use this skill when the user wants to:
- - Browse or search prediction markets (politics, crypto, sports, economics, weather)
- Place bets (limit orders, market orders) on event contracts
- Check market prices, spreads, and order books
- View ASCII candlestick charts
- Stream live price updates via WebSocket
- View or manage open orders
- Check portfolio positions and P/L
- Cancel or amend orders
- Monitor trade fills and settlements
- Use batch orders for market-making strategies
Common trigger phrases:
- - "What prediction markets are open on Kalshi?"
- "Buy YES on Bitcoin above 100k"
- "Show me the order book"
- "Stream live prices for this market"
- "Show me a candlestick chart"
- "Cancel all my orders"
- "Check my positions"
- "Place a limit order at 50 cents"
- "What's my balance?"
When NOT to use this skill:
- - User wants to trade stocks/ETFs/options (use Alpaca trading skill)
- User wants to trade on Polymarket (use Polymarket trading skill)
- User wants financial advice (provide tools, not recommendations)
Key Concepts
Tickers
Markets use structured tickers:
KXBTC-26FEB12-B97000
- -
KXBTC = series (Bitcoin) - INLINECODE14 = date (Feb 12, 2026)
- INLINECODE15 = strike ($97,000)
Events vs Markets
An
event groups related markets. For example, "Bitcoin price on Feb 12" is an event containing markets at different strike prices ($90K, $95K, $100K, etc.).
Contracts
Kalshi trades
event contracts priced 1-99 cents, settling to $1 or $0. All values are in
cents.
Subaccounts
Up to 32 subaccounts per user for multi-strategy isolation.
Order Groups
Cap total fills across multiple orders — useful for market-making where you don't want both sides filled.
Global Flags
Every command accepts these flags:
| Flag | Short | Default | Description |
|---|
| INLINECODE16 | | INLINECODE17 | Output as JSON for scripts |
| INLINECODE18 |
|
false | Plain text for piping |
|
--yes |
-y |
false | Skip all confirmation prompts |
|
--prod | |
false | Use production API (real money) |
|
--verbose |
-v |
false | Debug output |
|
--config | |
~/.kalshi/config.yaml | Config file path |
Core Commands
Authentication
CODEBLOCK6
Market Discovery
List markets:
CODEBLOCK7
Flags: --status (open/closed/settled), --series (filter by series ticker), --limit (default 50).
Get market details:
CODEBLOCK8
View order book:
CODEBLOCK9
View recent trades:
CODEBLOCK10
View candlestick chart:
CODEBLOCK11
Browse series (categories of markets):
CODEBLOCK12
Events
List events:
CODEBLOCK13
Flags: --status (active/closed/settled), --limit, --cursor.
Get event details:
CODEBLOCK14
Event candlestick chart:
CODEBLOCK15
Multivariate events:
CODEBLOCK16
Trading
Place a limit order:
CODEBLOCK17
Place a market order:
CODEBLOCK18
Sell contracts:
CODEBLOCK19
Skip confirmation (for bots):
CODEBLOCK20
Production trading (real money):
CODEBLOCK21
Order flags:
| Flag | Required | Default | Description |
|---|
| INLINECODE36 | Yes | | Market ticker |
| INLINECODE37 |
Yes | |
yes or
no |
|
--qty | Yes | | Number of contracts |
|
--price | Yes (limit) | | Price in cents (1-99) |
|
--action | No |
buy |
buy or
sell |
|
--type | No |
limit |
limit or
market |
Amend an order:
CODEBLOCK22
Cancel orders:
CODEBLOCK23
List and inspect orders:
CODEBLOCK24
Batch create orders from JSON file:
CODEBLOCK25
The JSON file format:
CODEBLOCK26
Portfolio
Check balance:
CODEBLOCK27
All values are in cents. Example JSON:
CODEBLOCK28
View positions:
CODEBLOCK29
View trade fills:
CODEBLOCK30
View settlements (resolved market payouts):
CODEBLOCK31
Subaccount management:
CODEBLOCK32
Order Groups
Order groups cap total fills across multiple orders — useful for market-making. Alias: og.
CODEBLOCK33
RFQ (Request for Quotes / Block Trading)
CODEBLOCK34
Quotes (Respond to RFQs)
CODEBLOCK35
Real-Time Streaming (WebSocket)
All watch commands require auth. Press Ctrl+C to stop. Auto-reconnects with exponential backoff.
CODEBLOCK36
Exchange Info
CODEBLOCK37
Configuration
CODEBLOCK38
Config file: INLINECODE52
Utility Commands
CODEBLOCK39
Environment Variables
| Variable | Description |
|---|
| INLINECODE53 | API Key ID |
| INLINECODE54 |
Private key PEM content |
|
KALSHI_PRIVATE_KEY_FILE | Path to private key PEM file |
|
KALSHI_API_PRODUCTION |
true for production |
|
KALSHI_API_TIMEOUT | HTTP timeout (e.g.,
60s) |
|
KALSHI_OUTPUT_FORMAT | Default output format |
Output Formats
All commands support --json, --plain, and default table output.
CODEBLOCK40
Exit codes: 0=success, 1=general error, 2=auth error, 3=validation error, 4=API error, 5=network error.
Common Workflows
Browse markets and research
CODEBLOCK41
Place a limit order and monitor
CODEBLOCK42
Market making with order groups
CODEBLOCK43
Bot automation (market-making script)
CODEBLOCK44
Stream live prices
CODEBLOCK45
Portfolio review
CODEBLOCK46
Go live (production)
CODEBLOCK47
Best Practices
Safety
- 1. Demo first — the CLI defaults to demo mode. Test everything before going live.
- Confirm before
--prod — always verify with kalshi-cli auth status before trading real money. - Use
--yes carefully — it skips all confirmations. Only use in tested bot scripts. - Set position limits — use order groups to cap maximum exposure.
- Monitor positions — use
kalshi-cli watch positions for real-time tracking.
Order Management
- 1. Prefer limit orders — better price control, lower fees.
- Use order groups for market-making — prevents both sides from filling simultaneously.
- Amend instead of cancel/replace — native
orders amend is atomic and faster. - Batch when possible — use
orders batch-create with a JSON file for multiple orders. - Check queue position — use
orders queue to see where your resting order sits.
Bot Development
- 1. Use
--json --yes — machine-parseable output, no interactive prompts. - Check exit codes — 0=success, 2=auth error, 4=API error, 5=network error.
- Handle rate limits — Basic: 10 writes/sec, 20 reads/sec. Apply for higher tiers if needed.
- Use WebSocket for live data —
watch ticker is more efficient than polling. - Store credentials securely — use env vars or keyring, never hardcode.
Command Reference
kalshi-cli auth login |
| Check status |
kalshi-cli auth status |
| List API keys |
kalshi-cli auth keys list |
|
Markets |
| List markets |
kalshi-cli markets list --status open --limit 20 |
| Get market |
kalshi-cli markets get TICKER |
| Order book |
kalshi-cli markets orderbook TICKER |
| Recent trades |
kalshi-cli markets trades TICKER --limit 20 |
| Candlestick chart |
kalshi-cli markets candlesticks TICKER --series SERIES --period 1h |
| Browse series |
kalshi-cli markets series list --category Crypto |
|
Events |
| List events |
kalshi-cli events list --status active --limit 20 |
| Get event |
kalshi-cli events get EVENT_TICKER |
| Event chart |
kalshi-cli events candlesticks EVENT_TICKER --period 1h |
|
Trading |
| Limit order (buy YES) |
kalshi-cli orders create --market TICKER --side yes --qty 10 --price 50 |
| Market order |
kalshi-cli orders create --market TICKER --side yes --qty 10 --type market |
| Sell contracts |
kalshi-cli orders create --market TICKER --side no --qty 5 --price 30 --action sell |
| Amend order |
kalshi-cli orders amend ORDER_ID --price 55 |
| Cancel order |
kalshi-cli orders cancel ORDER_ID |
| Cancel all |
kalshi-cli orders cancel-all |
| Batch create |
kalshi-cli orders batch-create --file orders.json |
| List resting orders |
kalshi-cli orders list --status resting |
| Queue position |
kalshi-cli orders queue ORDER_ID |
|
Portfolio |
| Balance |
kalshi-cli portfolio balance |
| Positions |
kalshi-cli portfolio positions |
| Fills |
kalshi-cli portfolio fills --limit 50 |
| Settlements |
kalshi-cli portfolio settlements |
|
Subaccounts |
| List |
kalshi-cli portfolio subaccounts list |
| Create |
kalshi-cli portfolio subaccounts create |
| Transfer |
kalshi-cli portfolio subaccounts transfer --from 1 --to 2 --amount 50000 |
|
Order Groups |
| Create group |
kalshi-cli order-groups create --limit 100 |
| List groups |
kalshi-cli og list |
| Update limit |
kalshi-cli order-groups update-limit GROUP_ID --limit 200 |
| Delete group |
kalshi-cli order-groups delete GROUP_ID |
|
Block Trading |
| Create RFQ |
kalshi-cli rfq create --market TICKER --qty 1000 |
| List RFQs |
kalshi-cli rfq list |
| Create quote |
kalshi-cli quotes create --rfq RFQ_ID --price 65 |
| Accept quote |
kalshi-cli quotes accept QUOTE_ID |
|
Streaming |
| Live prices |
kalshi-cli watch ticker TICKER |
| Orderbook deltas |
kalshi-cli watch orderbook TICKER |
| Public trades |
kalshi-cli watch trades |
| Your orders |
kalshi-cli watch orders |
| Your fills |
kalshi-cli watch fills |
| Your positions |
kalshi-cli watch positions |
|
Exchange |
| Exchange status |
kalshi-cli exchange status |
| Schedule |
kalshi-cli exchange schedule |
| Announcements |
kalshi-cli exchange announcements |
|
Config |
| Show config |
kalshi-cli config show |
| Set value |
kalshi-cli config set output.format json |
Important Notes
- - All values in cents — prices are 1-99, balances are in cents ($100 = 10000 cents).
- Demo by default — use
--prod flag for real trading. - Tickers are structured —
KXBTC-26FEB12-B97000 = series + date + strike. - Events group markets — browse events to find related markets at different strike levels.
- Order groups cap total fills — essential for market-making strategies.
- Rate limits — Basic: 10 writes/sec, 20 reads/sec. Apply for higher tiers via Kalshi.
- RSA-PSS auth — private key never leaves your machine. No passwords, no sessions to manage.
- USD settlement — no crypto, no wallets, no gas fees.
- CFTC-regulated — fully legal in the United States.
Fees
| Type | Formula | Max at 50/50 |
|---|
| Taker | INLINECODE121 | 1.75c/contract |
| Maker |
roundup(0.0175 * C * P * (1-P)) | ~0.44c/contract |
| S&P/Nasdaq markets | Half the normal rate | ~0.88c taker |
Lower fees for orders near the extremes (close to 0 or 100). No settlement or withdrawal fees (ACH).
Troubleshooting
Not authenticated
CODEBLOCK48
Wrong environment (demo vs prod)
CODEBLOCK49
Order rejected
- - Check balance: INLINECODE123
- Verify market is open: INLINECODE124
- Check exchange status: INLINECODE125
- Price must be 1-99 cents
Rate limited
- - Basic tier: 10 writes/sec, 20 reads/sec
- Apply for Advanced/Premier tier at Kalshi for higher limits
- Use batch operations where possible
Additional Resources
- - kalshi-cli: https://github.com/6missedcalls/kalshi-cli
- Kalshi API Docs: https://docs.kalshi.com/welcome
- Kalshi Fee Schedule: https://kalshi.com/fee-schedule
- Liquidity Incentive Program: https://help.kalshi.com/incentive-programs/liquidity-incentive-program
- Kalshi Python SDK: https://pypi.org/project/kalshi-python/
- Kalshi TypeScript SDK: https://www.npmjs.com/package/kalshi-typescript
Kalshi 交易技能
通过 kalshi-cli 命令行工具在 Kalshi 上交易 CFTC 监管的预测市场。浏览市场、下达限价单和市价单、管理仓位、实时流式获取价格以及查看 ASCII 蜡烛图——全部在终端中完成。
Kalshi 在美国完全合法。无需加密钱包、无需区块链、无需 Gas 费——一切以美元结算。
安装
macOS / Linux (Homebrew)
bash
brew install 6missedcalls/tap/kalshi-cli
Go 安装 (需要 Go 1.25+)
bash
go install github.com/6missedcalls/kalshi-cli/cmd/kalshi-cli@latest
从源码构建
bash
git clone https://github.com/6missedcalls/kalshi-cli.git
cd kalshi-cli
go build -o kalshi-cli ./cmd/kalshi-cli
身份验证
交互式登录 (首次推荐)
bash
kalshi-cli auth login
按照提示操作:
- 1. 复制显示的公钥
- 将其添加到您的 Kalshi 账户,网址为 https://kalshi.com/account/api-keys
- 在提示时输入 API 密钥 ID
凭据安全地存储在您的操作系统密钥环中(macOS Keychain、GNOME Keyring 或 Windows Credential Manager)。
非交互式登录 (机器人 / CI)
bash
通过标志
kalshi-cli auth login --api-key-id YOUR
KEYID --private-key-file /path/to/key.pem
通过 PEM 内容
kalshi-cli auth login --api-key-id YOUR
KEYID --private-key $(cat /path/to/key.pem)
通过环境变量
export KALSHI
APIKEY_ID=your-key-id
export KALSHI
PRIVATEKEY=$(cat /path/to/key.pem)
kalshi-cli auth login
配置文件
添加到 ~/.kalshi/config.yaml:
yaml
api
keyid: your-key-id
private
keypath: /path/to/key.pem
凭据按以下顺序解析:配置文件、环境变量、操作系统密钥环。
演示环境 vs 生产环境
| 演示环境 (默认) | 生产环境 |
|---|
| 标志 | (默认) | --prod |
| API |
demo-api.kalshi.co | api.elections.kalshi.com |
| 资金 | 虚拟/测试 | 真实美元 |
CLI 默认为演示模式。 您必须传递 --prod 才能使用真实资金进行交易。这是一项安全功能。
概述
您是使用 kalshi-cli 在 Kalshi 上进行预测市场交易的专家。您的目标是在强调安全和风险意识的同时,帮助用户高效交易事件合约。
如何使用此技能
- 1. 安全第一:CLI 默认为演示模式。仅在用户明确想要真实交易时才使用 --prod。
- 交易前验证:始终显示确切的命令,并在执行交易前与用户确认。
- 检查先决条件:确认已设置身份验证 (auth status)、交易所处于活动状态 (exchange status) 并且有足够的余额。
- 使用 JSON 输出:对于脚本编写和自动化,使用 --json 获取机器可读的输出。
- 理解代码:市场使用结构化的代码,如 KXBTC-26FEB12-B97000。事件将相关市场分组。
何时使用此技能
当用户想要以下操作时,使用此技能:
- - 浏览或搜索预测市场(政治、加密货币、体育、经济、天气)
- 对事件合约下注(限价单、市价单)
- 检查市场价格、价差和订单簿
- 查看 ASCII 蜡烛图
- 通过 WebSocket 流式获取实时价格更新
- 查看或管理未成交订单
- 检查投资组合仓位和盈亏
- 取消或修改订单
- 监控交易成交和结算
- 使用批量订单进行做市策略
常见的触发短语:
- - Kalshi 上有什么预测市场开放?
- 买入比特币超过 10 万的 YES
- 显示订单簿
- 流式获取此市场的实时价格
- 显示蜡烛图
- 取消我所有的订单
- 检查我的仓位
- 以 50 美分下个限价单
- 我的余额是多少?
何时不使用此技能:
- - 用户想要交易股票/ETF/期权(使用 Alpaca 交易技能)
- 用户想要在 Polymarket 上交易(使用 Polymarket 交易技能)
- 用户想要财务建议(提供工具,而非建议)
关键概念
代码
市场使用结构化的代码:KXBTC-26FEB12-B97000
- - KXBTC = 系列(比特币)
- 26FEB12 = 日期(2026 年 2 月 12 日)
- B97000 = 执行价($97,000)
事件 vs 市场
一个
事件将相关市场分组。例如,2 月 12 日的比特币价格是一个事件,包含不同执行价($90K、$95K、$100K 等)的市场。
合约
Kalshi 交易
事件合约,定价为 1-99 美分,结算为 $1 或 $0。所有值均以
美分为单位。
子账户
每个用户最多 32 个子账户,用于多策略隔离。
订单组
限制多个订单的总成交数量——适用于不希望双方同时成交的做市策略。
全局标志
每个命令都接受这些标志:
| 标志 | 缩写 | 默认值 | 描述 |
|---|
| --json | | false | 以 JSON 格式输出,用于脚本 |
| --plain |
| false | 纯文本,用于管道传输 |
| --yes | -y | false | 跳过所有确认提示 |
| --prod | | false | 使用生产环境 API(真实资金) |
| --verbose | -v | false | 调试输出 |
| --config | | ~/.kalshi/config.yaml | 配置文件路径 |
核心命令
身份验证
bash
kalshi-cli auth login # 交互式登录
kalshi-cli auth login --api-key-id ID --private-key-file /path/to/key.pem # 非交互式
kalshi-cli auth logout # 移除存储的凭据
kalshi-cli auth status # 检查身份验证状态 + 环境
kalshi-cli auth keys list # 列出 API 密钥
kalshi-cli auth keys create --name my-bot # 创建新的 API 密钥
kalshi-cli auth keys delete KEY_ID # 删除 API 密钥
市场发现
列出市场:
bash
kalshi-cli markets list --status open --limit 20
kalshi-cli markets list --series KXBTC --json
标志:--status (open/closed/settled)、--series (按系列代码筛选)、--limit (默认 50)。
获取市场详情:
bash
kalshi-cli markets get KXBTC-26FEB12-B97000
查看订单簿:
bash
kalshi-cli markets orderbook KXBTC-26FEB12-B97000
kalshi-cli markets orderbook KXBTC-26FEB12-B97000 --json
查看近期交易:
bash
kalshi-cli markets trades KXBTC-26FEB12-B97000 --limit 20
查看蜡烛图:
bash
kalshi-cli markets candlesticks KXBTC-26FEB12-B97000 --series KXBTC
kalshi-cli markets candlesticks KXBTC-26FEB12-B97000 --series KXBTC --period 1d
周期:1m、1h、1d
浏览系列(市场类别):
bash
kalshi-cli markets series list --category Economics
kalshi-cli markets series list --category Crypto
kalshi-cli markets series list --category Politics
kalshi-cli markets series get KXBTC
事件
列出事件:
bash
kalshi-cli events list --limit 20
kalshi-cli events list --status active
标志:--status (active/closed/settled)、--limit、--cursor。
获取事件详情:
bash
kalshi-cli events