Kalshi Prediction Markets
Read-only integration with Kalshi's prediction market API.
Capabilities
- - Browse markets: List active events and markets by category
- Market analysis: Get prices, volumes, orderbook depth
- Portfolio view: Check positions and P&L (requires API key)
- Trade recommendations: Find high-certainty, high-payoff opportunities
Setup
Install dependencies:
CODEBLOCK0
For portfolio access (RSA key signing required):
- 1. Go to kalshi.com/account/profile
- Create new API key → save the Key ID and download the private key
- Store credentials:
CODEBLOCK1
- 4. Create
~/.kalshi/credentials.json:
CODEBLOCK2
Or run interactive setup:
CODEBLOCK3
Scripts
Market Data (No Auth Required)
CODEBLOCK4
Portfolio (Auth Required)
CODEBLOCK5
Opportunity Analysis
The opportunities command identifies markets where:
- - High certainty: Price ≥85¢ YES or ≤15¢ YES (implies 85%+ confidence)
- Meaningful payoff: Potential return ≥10% on capital
- Sufficient liquidity: Orderbook depth supports reasonable position size
Formula: INLINECODE2
A good opportunity has: EV / cost > 0.1 (10%+ expected return)
Categories
Kalshi markets span:
- - Politics & Elections
- Economics (Fed rates, inflation, GDP)
- Weather & Climate
- Finance (stock prices, crypto)
- Entertainment & Sports
- Science & Tech
API Reference
See references/api.md for endpoint details.
Important Notes
- - This skill is READ-ONLY — no trade execution
- Public endpoints don't require authentication
- Portfolio/balance requires API credentials
- Markets settle in cents (100¢ = $1)
- All times in UTC
Kalshi预测市场
与Kalshi预测市场API的只读集成。
功能
- - 浏览市场:按类别列出活跃事件和市场
- 市场分析:获取价格、成交量、订单簿深度
- 投资组合查看:检查持仓和盈亏(需要API密钥)
- 交易建议:寻找高确定性、高回报机会
设置
安装依赖:
bash
pip install requests cryptography
如需访问投资组合(需要RSA密钥签名):
- 1. 前往 kalshi.com/account/profile
- 创建新的API密钥 → 保存密钥ID并下载私钥
- 存储凭证:
bash
mkdir -p ~/.kalshi
mv ~/Downloads/your-key-file.txt ~/.kalshi/private_key.pem
chmod 600 ~/.kalshi/private_key.pem
- 4. 创建 ~/.kalshi/credentials.json:
json
{
api
keyid: your-key-id-here,
private
keypath: ~/.kalshi/private_key.pem
}
或运行交互式设置:
bash
python scripts/kalshi_portfolio.py setup
脚本
市场数据(无需认证)
bash
列出热门市场
python scripts/kalshi_markets.py trending
按查询搜索市场
python scripts/kalshi_markets.py search bitcoin
获取特定市场详情
python scripts/kalshi_markets.py market TICKER
寻找高价值机会
python scripts/kalshi_markets.py opportunities
投资组合(需要认证)
bash
查看持仓
python scripts/kalshi_portfolio.py positions
查看余额
python scripts/kalshi_portfolio.py balance
交易历史
python scripts/kalshi_portfolio.py history
机会分析
opportunities命令识别以下市场:
- - 高确定性:YES价格≥85美分或YES价格≤15美分(表示85%+置信度)
- 有意义回报:潜在资本回报率≥10%
- 充足流动性:订单簿深度支持合理仓位规模
公式:期望值 = 概率 回报 - (1 - 概率) 成本
优质机会满足:EV / 成本 > 0.1(10%+预期回报)
类别
Kalshi市场涵盖:
- - 政治与选举
- 经济(美联储利率、通胀、GDP)
- 天气与气候
- 金融(股票价格、加密货币)
- 娱乐与体育
- 科学与科技
API参考
端点详情请参见 references/api.md。
重要说明
- - 此技能为只读——不执行交易
- 公共端点无需认证
- 投资组合/余额需要API凭证
- 市场以美分结算(100美分 = 1美元)
- 所有时间均为UTC时间