Prediction Market Arbiter — Cross-Platform Divergence Scanner
Overview
Prediction Market Arbiter is a systematic price comparison engine for prediction markets. It scans Kalshi and Polymarket simultaneously, identifies identical or near-identical events priced differently across platforms, and alerts you to potential arbitrage opportunities or market mispricings.
What It Does
Core Function: Compare YES prices for the same event across Kalshi and Polymarket. When the same market exists on both platforms but with significant price divergences, alert the trader to potential inefficiency.
Example:
- - Market: "Will Bitcoin exceed $100k by Dec 2026?"
- Kalshi price: 72¢ (72% implied probability)
- Polymarket price: 58¢ (58% implied probability)
- Divergence: 14 percentage points = arbitrage signal
The arbiter detects these inefficiencies automatically, filters by volume and match quality, and ranks them by spread size.
Key Features
- - Fuzzy Title Matching — Uses Jaccard similarity (word overlap) to identify the same event across different platform vocabularies
- Configurable Divergence Threshold — Default 8%; tune for your risk tolerance
- Volume Filtering — Combines Kalshi + Polymarket volume; minimum 1000 default
- Match Confidence — Only pairs markets with >60% title similarity (configurable)
- Pagination — Fetches top 1000 Kalshi markets (5 pages × 200) + top 200 Polymarket (by volume)
- Cache Results — Saves matches to JSON for programmatic access and follow-up analysis
- Multi-Platform Support — Uses Kalshi API (with client authentication) and Polymarket Gamma API (no auth required)
When to Use This Skill
- - You trade across Kalshi and Polymarket and want to find price inefficiencies automatically
- You're arbitraging prediction markets and need real-time divergence alerts
- You want to understand market structure: which platform leads on certain event types?
- You're analyzing prediction market microstructure and efficiency
- You need a scheduled divergence scanner (every 4 hours, daily, etc.)
Requirements
API Keys & Credentials
- 1. Kalshi API Key (free, required)
- Sign up at https://kalshi.com
- Navigate to Settings → API
- Generate API credentials (key ID + private key file)
- Cost: Free tier, unlimited reads
- 2. Polymarket Access (free, no authentication)
- Gamma API is public: https://gamma-api.polymarket.com
- No API key required
- No cost
Python & Dependencies
- - Python 3.10 or higher
- Required packages:
CODEBLOCK0
Configuration
Create or update your config.yaml:
CODEBLOCK1
Threshold Tuning Guide
| Parameter | Default | When to Adjust |
|---|
| INLINECODE1 | 8.0% | Lower (5%) for more alerts; higher (15%) for only major spreads |
| INLINECODE2 |
0.6 | Raise to 0.7+ to be stricter (fewer false matches); lower to 0.5 for loose matching |
|
min_volume | 1000 | Lower for illiquid opportunities; raise to 5000+ for only liquid pairs |
How It Works
Phase 1: Fetch Markets
Kalshi: Paginate through active markets (status=open), fetching up to 5 pages of 200 markets each (max 1000 markets).
- - Extract: title, ticker, yes_price (cents), volume, open interest
Polymarket: Fetch top 200 markets sorted by volume from Gamma API.
- - Extract: question text (title), yes_price (in cents), volume
Phase 2: Fuzzy Title Matching
For each Kalshi market, compare against all Polymarket markets using Jaccard similarity:
CODEBLOCK2
Only pairs with similarity >= threshold advance to comparison.
Example — Successful Match:
CODEBLOCK3
Example — No Match (Different Events):
CODEBLOCK4
Tuning note: Markets with similar topics but different vocabulary (e.g., "Bitcoin" vs "BTC") may not match at default thresholds. Lower fuzzy_match_threshold to 0.4-0.5 for broader matching, or use the aggressive config profile.
Phase 3: Filter by Volume
Combined volume = Kalshi volume + Polymarket volume
- - If combined volume < min_volume threshold, drop the pair
- Filters out low-liquidity pairs where arbitrage isn't actionable
Phase 4: Calculate Divergence
For each matched pair:
CODEBLOCK5
If delta_pct >= threshold, add to alerts.
Phase 5: Sort & Alert
Sort divergences by largest spread first. Return top N (default 5 in alerts).
Example output:
CODEBLOCK6
Cache Results
Write all matches (top 20) to JSON:
CODEBLOCK7
Divergence Interpretation
Common Divergence Patterns
1. Polymarket Leads on Hype Events
- - Recent news → PM moves first (higher volume of retail traders)
- Look for Kalshi underpriced relative to PM on breaking news
2. Kalshi Leads on Structural Events
- - Predictable political cycles, economic data → Kalshi often ahead
- PM sometimes lags
3. Liquidity-Driven Spreads
- - If one platform is much more liquid, it's often the "fair price"
- Illiquid platform = potential mispricing
4. Time-of-Day Effects
- - US markets hours: Kalshi often tighter
- Asian hours: PM may be the pricing engine
Scheduling
Command-Line Usage
CODEBLOCK8
As a Cron Job (Every 4 Hours)
CODEBLOCK9
As an OpenClaw Scheduled Task
CODEBLOCK10
Example Output
Alert Message
CODEBLOCK11
Cache Output
File: INLINECODE5
CODEBLOCK12
API Reference
Main Function
CODEBLOCK13
Configuration Object
CODEBLOCK14
Troubleshooting
No Matches Found
Possible causes:
- 1. Threshold too strict — Raise divergencethresholdpct or lower fuzzymatchthreshold
- Low market overlap — Most Kalshi markets don't have Polymarket equivalents
- Both platforms down — Check status pages
Wrong Matches (False Positives)
If fuzzy matching is pairing unrelated markets:
CODEBLOCK15
API Failures
Kalshi API error:
- - Check API key validity:
kalshi_api_key_id and private_key_file path - Verify key has "read-only" permission (sufficient for this skill)
Polymarket API error:
- - Polymarket Gamma API is public; if it fails, their servers are down
- Check https://gamma-api.polymarket.com/markets directly in browser
Performance
Typical run: 30-90 seconds
- - Kalshi fetch: 10-30s (paginating 5 pages)
- Polymarket fetch: 5-15s
- Matching: <5s
- If taking >2 minutes, reduce kalshimaxpages or polymarket_limit
Performance & Cost
Typical Run Metrics
- - Runtime: 30-90 seconds
- API calls:
- Kalshi: 5 calls (page 1-5)
- Polymarket: 1 call (top 200 by volume)
- - Cost: $0 (all reads, no premium APIs)
Scaling
For 6 runs per day (every 4 hours):
- - Kalshi: 30 API calls/day (free tier handles 1000s)
- Polymarket: 6 API calls/day (public API)
- Total cost: $0
OpenClaw Ecosystem Integration
Cross-platform price comparison engine for the Prediction Market Trading Stack.
| Connected Skill | How It Connects |
|---|
| Market Morning Brief | Divergences appear in your daily morning digest |
| Kalshi Command Center |
Trade the Kalshi side of flagged divergences |
|
Polymarket Command Center | Browse the Polymarket side for context |
|
Kalshalyst | Compare contrarian edges against cross-platform pricing |
Install the complete stack:
CODEBLOCK16
Implementation Notes
Battle-tested in production trading environments. Design principles:
- 1. Standalone config/logging — works with any OpenClaw setup
- Direct alerts — sends divergences straight to you
- All thresholds and matching logic — refined through live cross-platform trading
- Standalone scripts — zero external dependencies beyond listed packages
Configuration Example
conservative.yaml (Wide Spreads Only)
CODEBLOCK17
aggressive.yaml (Early Detection)
CODEBLOCK18
Further Reading
- - See
references/fuzzy-matching.md for detailed explanation of title matching and threshold tuning
Support & Iteration
Common iteration paths:
- 1. Threshold Tuning — Adjust divergencethresholdpct and fuzzymatchthreshold based on your alert frequency
- Volume Filtering — Increase minvolume to focus on only liquid pairs
- Scheduling — Change checkintervalminutes (240 = 4 hours, 60 = 1 hour, etc.)
- Platform Expansion — Add new platforms (Manifold Markets, Betfair, etc.) by implementing fetchXmarkets() functions
License & Attribution
Author: KingMadeLLC
Feedback & Issues
Found a bug? Have a feature request? Want to share results?
Part of the OpenClaw Prediction Stack — the first prediction market skill suite on ClawHub.
预测市场套利扫描器 — 跨平台价差扫描器
概述
预测市场套利扫描器是一个系统化的预测市场价格比较引擎。它同时扫描Kalshi和Polymarket,识别在不同平台上定价相同或高度相似的事件,并向您提示潜在的套利机会或市场错误定价。
功能说明
核心功能: 比较同一事件在Kalshi和Polymarket上的YES价格。当同一市场在两个平台存在但价格出现显著差异时,向交易者提示潜在的低效市场。
示例:
- - 市场:比特币在2026年12月前是否超过10万美元?
- Kalshi价格:72美分(72%隐含概率)
- Polymarket价格:58美分(58%隐含概率)
- 价差:14个百分点 = 套利信号
套利扫描器自动检测这些低效市场,按成交量和匹配质量进行筛选,并按价差大小排序。
主要特性
- - 模糊标题匹配 — 使用Jaccard相似度(词语重叠率)识别不同平台词汇体系中的同一事件
- 可配置价差阈值 — 默认8%;可根据风险承受能力调整
- 成交量过滤 — 合并Kalshi + Polymarket成交量;默认最低1000
- 匹配置信度 — 仅匹配标题相似度>60%的市场(可配置)
- 分页获取 — 获取前1000个Kalshi市场(5页×200)+ 前200个Polymarket市场(按成交量排序)
- 缓存结果 — 将匹配结果保存为JSON,便于程序化访问和后续分析
- 多平台支持 — 使用Kalshi API(需客户端认证)和Polymarket Gamma API(无需认证)
何时使用此技能
- - 您在Kalshi和Polymarket之间进行交易,希望自动发现价格低效市场
- 您在进行预测市场套利,需要实时价差提醒
- 您想了解市场结构:哪个平台在某些事件类型上领先?
- 您正在分析预测市场的微观结构和效率
- 您需要一个定时运行的价差扫描器(每4小时、每日等)
环境要求
API密钥与凭证
- 1. Kalshi API密钥(免费,必需)
- 在 https://kalshi.com 注册
- 进入设置 → API
- 生成API凭证(密钥ID + 私钥文件)
- 费用:免费版,无限读取
- 2. Polymarket访问(免费,无需认证)
- Gamma API为公开接口:https://gamma-api.polymarket.com
- 无需API密钥
- 无费用
Python及依赖
bash
pip install kalshi-python requests pyyaml
配置
创建或更新您的 config.yaml:
yaml
kalshi:
enabled: true
apikeyid: your-key-id-here
privatekeyfile: path/to/private.key
predictionmarketarbiter:
enabled: true
checkintervalminutes: 240 # 4小时(默认)
divergencethresholdpct: 8.0 # 最低价差百分比,触发提醒
fuzzymatchthreshold: 0.6 # Jaccard相似度阈值
min_volume: 1000 # 最低合并成交量
kalshimaxpages: 5 # 获取页数(最多5×200=1000)
polymarket_limit: 200 # 按成交量排序的前N个市场
阈值调整指南
| 参数 | 默认值 | 何时调整 |
|---|
| divergencethresholdpct | 8.0% | 降低(5%)获取更多提醒;提高(15%)仅关注重大价差 |
| fuzzymatchthreshold |
0.6 | 提高到0.7+更严格(减少错误匹配);降低到0.5进行宽松匹配 |
| min_volume | 1000 | 降低以发现流动性不足的机会;提高到5000+仅关注流动性强的配对 |
工作原理
第一阶段:获取市场
Kalshi: 分页获取活跃市场(status=open),最多获取5页,每页200个市场(最多1000个市场)。
- - 提取:标题、代码、YES价格(美分)、成交量、未平仓合约
Polymarket: 从Gamma API获取按成交量排序的前200个市场。
- - 提取:问题文本(标题)、YES价格(美分)、成交量
第二阶段:模糊标题匹配
对每个Kalshi市场,使用Jaccard相似度与所有Polymarket市场进行比较:
awords = set(kalshititle.lower().split())
bwords = set(polymarkettitle.lower().split())
移除常见停用词(the, a, will, in, on等)
a_words -= stopwords
b_words -= stopwords
similarity = len(awords ∩ bwords) / len(awords ∪ bwords)
仅相似度>=阈值的配对进入比较阶段。
示例 — 成功匹配:
Kalshi: 美联储是否会在2026年6月前降息?
Polymarket: 美联储是否会在2026年6月前降息?
移除停用词后:
a_words = {federal, reserve, cut, rates, june, 2026}
b_words = {fed, cut, interest, rates, june, 2026}
交集:{cut, rates, june, 2026}
并集:{federal, reserve, fed, interest, cut, rates, june, 2026}
相似度:4/8 = 0.50
示例 — 不匹配(不同事件):
Kalshi: 比特币在2026年12月前是否超过10万美元?
Polymarket: 以太坊在2026年底前是否达到1万美元?
移除停用词后:
a_words = {bitcoin, exceed, 100000, december, 2026}
b_words = {ethereum, hit, 10000, end, 2026}
交集:{2026}
并集:{bitcoin, exceed, 100000, december, ethereum, hit, 10000, end, 2026}
相似度:1/9 = 0.11(不匹配 — 正确排除)
调整说明: 主题相似但词汇不同的市场(例如Bitcoin与BTC)在默认阈值下可能无法匹配。将fuzzymatchthreshold降低到0.4-0.5以扩大匹配范围,或使用激进配置方案。
第三阶段:按成交量过滤
合并成交量 = Kalshi成交量 + Polymarket成交量
- - 如果合并成交量 < 最低成交量阈值,则丢弃该配对
- 过滤掉流动性不足、无法进行套利的配对
第四阶段:计算价差
对每个匹配的配对:
delta = |kalshiprice - polymarketprice| (以美分计)
midpoint = (kalshiprice + polymarketprice) / 2
delta_pct = (delta / midpoint) × 100
如果delta_pct >= 阈值,则添加到提醒列表。
第五阶段:排序与提醒
按价差从大到小排序。返回前N个(提醒中默认5个)。
输出示例:
📊 跨平台价差(>=8%):
比特币在2026年底前是否超过10万美元?
Kalshi 72美分 vs PM 58美分(↓14%)
特朗普会赢得2028年大选吗?
Kalshi 68美分 vs PM 61美分(↑7%)[不匹配 - 低于阈值]
缓存结果
将所有匹配结果(前20个)写入JSON:
json
{
matches: [
{
kalshi_title: 比特币在2026年12月前是否超过10万美元?,
pm_title: 比特币在2026年底前超过10万?,
kalshi_price: 72,
pm_price: 58,
delta: 14,
delta_pct: 19.4,
match_score: 0.82
}
],
kalshi_count: 847,
pm_count: 198,
timestamp: 1709856000.123
}
价差解读
常见价差模式
1. Polymarket在热门事件上领先
- - 近期新闻 → PM率先变动(散户交易者成交量更高)
- 关注Kalshi在突发新闻中相对于PM定价偏低的情况
2. Kalshi在结构性事件上领先
- - 可预测的政治周期、经济数据 → Kalshi通常领先
- PM有时滞后
3. 流动性驱动的价差