jzOcb

kalshi-trading

AI-powered prediction market trading system with decision engine and paper trading validation.

jzOcb 1 1 Updated 4mo ago
GitHub

Install

npx skillscat add jzocb/kalshi-trading

Install via the SkillsCat registry.

SKILL.md

Kalshi Trading System

AI驱动的预测市场决策引擎 + Paper Trading验证系统。

自动扫描Kalshi政治/经济市场,基于官方数据源、新闻验证和规则分析做出BUY/WAIT/SKIP决策。

Quick Start

Run Daily Scan

cd ~/clawd/kalshi
python3 report_v2.py

Check Paper Trading Status

python3 paper_trading.py

View Trades

cat trades.json | python3 -m json.tool

Core Commands

1. Market Scanning

扫描所有政治/经济市场,找出高确定性机会(Junk Bonds):

python3 report_v2.py

输出:

  • 🟢 BUY推荐(评分≥70):有官方数据源、新闻验证、规则明确
  • 🟡 WAIT候选(50-69分):需要更多验证
  • 报告保存到 reports/report-YYYY-MM-DD.txt

2. Deep Market Analysis

单个市场深入分析(需要时手动调用):

python3 decision.py KXGDP-26JAN30-T2.5

3. Paper Trading Management

记录新推荐:

python3 paper_trading.py record <ticker> <title> <BUY> <side> <price> <position> <score> <reasons> <expiration> <url>

更新结算结果:

python3 paper_trading.py update <trade_id> <WIN|LOSS> <settled_price>

查看统计:

python3 paper_trading.py summary

Decision Criteria

Scoring System (0-100分)

  • 年化收益每100%: +10分
  • Spread ≤3¢: +10分,≤5¢: +5分
  • 官方数据源(BEA/BLS/Fed): +30分
  • 无程序性风险: +20分
  • 3+条相关新闻: +20分
  • 规则模糊: -10分

Decision Thresholds

  • ≥70分 → BUY (高信心推荐)
  • 50-69分 → WAIT (需要更多验证)
  • <50分 → SKIP (拒绝)

Core Principles

  • 没有新闻验证 = 赌博
  • 没有官方数据源 = 太主观
  • 规则模糊 = 拒绝
  • Edge小(<5%) = 不值得

⚠️ 铁律:Report必须查证!(2026-02-02)

每次给用户发送report/推荐时,必须验证底层事实:

  1. 数据是否已发布? — 比如GDP市场,BEA是否已发布实际数字?CPI市场,BLS是否已发布?
  2. 如果已发布,实际数字是多少? — 直接告诉用户结果,这才是"free money"
  3. 如果未发布,发布日期是什么时候? — 告诉用户还有不确定性
  4. 确定性评估 — 基于已知事实,这个bet有多确定?

禁止:

  • ❌ 只看价格就推荐("91¢所以几乎确定"是错误逻辑)
  • ❌ 让用户自己去查证(报告的价值就在于已验证的信息)
  • ❌ 把未验证的信息当确定性推荐

正确流程:

1. 扫描市场找到候选
2. 查证底层数据(BEA/BLS/Fed/官方来源)
3. 标注:✅已确认 / ⏳待发布(日期) / ⚠️需验证
4. 只有✅已确认的才标为高信心推荐

数据源查证清单:

  • GDP → BEA (bea.gov/data/gdp)
  • CPI → BLS (bls.gov/cpi)
  • Fed Rate → Federal Reserve (federalreserve.gov)
  • Government Shutdown → OPM (opm.gov)
  • 其他 → 在report中注明数据源和状态

Automation

Daily Scan via Cron

Add to cron (runs every morning at 9 AM):

clawdbot cron add \
  --name "Kalshi daily scan" \
  --cron "0 9 * * *" \
  --session isolated \
  --message "cd ~/clawd/kalshi && python3 report_v2.py && python3 paper_trading.py summary" \
  --channel telegram \
  --deliver

Or via heartbeat (add to HEARTBEAT.md):

## Kalshi Daily Scan
- 每天早上跑一次(查 heartbeat-state.json 的 lastChecks.kalshi_daily_scan)
- 执行: `cd ~/clawd/kalshi && python3 report_v2.py`
- 如果有🟢 BUY推荐(评分≥70) → 简短汇报

Files Overview

  • report_v2.py - Main scan + decision engine
  • decision.py - Single market analysis
  • paper_trading.py - Trade tracking tool
  • trades.json - Trade database
  • research.py - Deep research (news, data sources)
  • README.md - Full documentation

Usage Examples

Example 1: Daily Morning Scan

# In your morning routine (via cron or heartbeat)
cd ~/clawd/kalshi && python3 report_v2.py

# Agent will:
# 1. Scan 500+ markets
# 2. Find extreme-price candidates
# 3. Fetch rules + news for each
# 4. Score and decide (BUY/WAIT/SKIP)
# 5. Auto-record BUY recommendations to paper trading

Example 2: Manual Research

# Deep dive into a specific market
python3 decision.py KXCPI-26FEB-T0.0

# Output:
# - Full rules analysis
# - Data source identification
# - Procedural risk assessment
# - News validation
# - BUY/WAIT/SKIP decision with reasoning

Example 3: Settlement Day

# Feb 11: CPI data released, market settled
python3 paper_trading.py update 1 WIN 100

# Update trade #1 as WIN (settled at 100¢)
# System calculates P&L and updates stats

Kalshi Market Timing

Markets have 3 time fields:

  • expected_expiration_time: Data expected release date
  • close_time: Trading deadline ← Use this for "days remaining"
  • latest_expiration_time: Latest settlement date

Always use close_time to calculate trading window!

Safety & Validation

This is paper trading — validation phase before real money.

Goals:

  1. Test if scoring system is reasonable
  2. Verify data source detection accuracy
  3. Validate news verification effectiveness
  4. Build historical track record

Only consider real trading after:

  • ✅ Accuracy rate >70%
  • ✅ Consistent profitability over 20+ trades
  • ✅ Understanding of edge cases and failure modes

Troubleshooting

"No BUY recommendations"

  • Normal! Most high-yield markets fail verification (no data source, ambiguous rules)
  • The system correctly rejects risky bets
  • Check WAIT/SKIP reasons to understand why

"Market already expired"

  • Check close_time not expected_expiration_time
  • Data release delays are common

"News validation fails"

  • Google News might rate-limit
  • News search extracts keywords from title - check if title is too generic

Next Steps

After validating with paper trading:

  1. Integrate research.py for deeper analysis
  2. Add cross-market arbitrage detection
  3. Build historical accuracy tracker
  4. Implement position sizing / risk management
  5. Connect to Kalshi API for real trading

Created: 2026-02-01
Status: ✅ Paper Trading Validation Phase
Author: JZ + AI Assistant