Fuku Predictions — Conversational Kalshi Trading Skill
Trade prediction markets through conversation. The agent learns what you care about, builds a personalized profile, then scans Kalshi markets for opportunities that match your style.
Three Modes
1. Profile Building (Interactive)
User describes preferences → agent builds a trading profile → saves for reuse.
2. Conversational Scanning
Agent scans markets using the profile → presents matching opportunities → user approves trades.
3. Autonomous Trading
Agent scans and trades automatically within risk limits.
Setup
Dependencies
CODEBLOCK0
Kalshi API Key
Create
.env in the skill directory:
KALSHI_API_KEY_ID=your_key_id
KALSHI_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----"
Get credentials: https://kalshi.com/profile/api
Defining Preferences
Users express what they care about in natural language:
Situational: "I want home dogs getting 7+ points in CBB" · "Show me letdown spots after big wins" · "Find revenge games where the underdog lost by 15+ last time"
Player Mismatches: "Games where the best player has a 50+ FPR gap" · "Matchups when a star player is injured"
Statistical: "Only games with top 30 defenses" · "Pace mismatches (fast vs slow)" · "Spreads under 3 points"
Risk & Sizing: "$5 bets on highest confidence plays" · "Max 8 trades per day" · "Quarter-Kelly sizing"
Agent Tools
Profile Management
CODEBLOCK2
Market Browser
CODEBLOCK3
Direct Kalshi Access
python3 scripts/kalshi_client.py balance
python3 scripts/kalshi_client.py positions
python3 scripts/kalshi_client.py markets --series KXNBASPREAD
Presenting Markets to Users
Always include: the market, price (dollars), model prediction, edge, payout, and recommendation.
Talk in dollars, not contracts. Users say "$5 on Boston" — convert to contracts internally.
Three-tier display per market type:
- - Main line — contract closest to 50¢ (market consensus)
- 🔒 Safer — highest edge (high confidence, modest payout)
- 🎰 Riskier — near model's predicted line (~50% model probability, bigger payout, ≥3% edge required)
Edge icons: 🔥 ≥20% · ✅ ≥10% · 📊 ≥5% · ➖ <5%
Example:
CODEBLOCK5
Dollar-to-Contract Math
"$5 on BOS -8.5" at 31¢ → floor($5 / $0.31) = 16 contracts × $0.31 = $4.96 cost → $16.00 payout if YES → $11.04 profit.
Trading
CODEBLOCK6
Edge Math
Normal distribution probability conversion (no scipy):
- - Uses
math.erfc for CDF - Sport-specific σ: CBB spread 12.0 / total 11.0, NBA 11.0 / 10.5, NHL 1.5 / 1.3, Soccer 1.2 / 1.1
- Player props: σ = 30% of predicted value (min 2.0)
Kalshi Market Structure
- - Series (sport):
KXNBASPREAD, KXNBATOTAL, INLINECODE4 - Event (game): INLINECODE5
- Market (contract):
KXNBASPREAD-26MAR02BOSMIL-BOS7 → "Boston wins by over 7.5?"
Pricing: YES/NO in cents (1-99). YES 31¢ = 31% implied. 1 contract = $1 max payout.
Supported Sports
| Sport | Spread | Total | ML | Props |
|---|
| NBA | INLINECODE7 | INLINECODE8 | INLINECODE9 | — |
| CBB |
KXNCAAMBSPREAD |
KXNCAAMBTOTAL |
KXNCAABGAME | — |
| NHL |
KXNHLSPREAD |
KXNHLTOTAL |
KXNHLGAME | Goals/Pts/Ast |
| Soccer | Per-league (EPL/La Liga/Serie A/Bundesliga/Ligue 1/UCL/MLS) | Per-league | Per-league | BTTS |
Autopilot Config
INLINECODE16 :
CODEBLOCK7
Modes: dry_run (log only) · approve (ask user) · auto (hands-free)
Safety
- - Max daily loss limit (default 10%)
- Position size caps (default 5% per trade)
- Kill switch:
touch KILL_SWITCH in skill directory - All trades logged locally to INLINECODE21
- API keys never leave the machine
Kalshi API Auth
RSA-PSS signatures. The client handles this automatically.
Signing quirk: Portfolio endpoints sign path WITHOUT query strings. Market endpoints sign WITH. See _SIGN_PATH_ONLY in kalshi_client.py.
Fuku Prediction API (Public)
Base: https://cbb-predictions-api-nzpk.onrender.com
| Endpoint | Data |
|---|
| INLINECODE25 | CBB predictions |
| INLINECODE26 |
NBA predictions |
|
/api/public/nhl/predictions?date=YYYY-MM-DD | NHL predictions |
|
/api/public/soccer/predictions?date=YYYY-MM-DD | Soccer predictions |
|
/api/public/cbb/rankings?limit=N | Team FPR rankings |
|
/api/public/cbb/players?team=X&limit=N | Player FPR data |
Files
| File | Purpose |
|---|
| INLINECODE31 | Primary — markets with predictions, edges, payouts |
| INLINECODE32 |
Conversational profile building + scanning |
|
scripts/profile_engine.py | Profile-based opportunity scoring |
|
scripts/profile_builder.py | Natural language → profile JSON |
|
scripts/autopilot.py | Autonomous scanning + trading pipeline |
|
scripts/kalshi_client.py | Kalshi API client (auth, orders, markets) |
|
scripts/scanner.py | Full edge scanner (all contracts) |
|
scripts/executor.py | Trade execution with risk management |
|
scripts/portfolio.py | Position tracking and P&L |
|
scripts/setup.py | Interactive setup wizard |
|
config/config.json | Strategy and risk settings |
|
config/profiles/*.json | User trading profiles |
|
references/strategies.md | Strategy explanations |
|
references/kalshi-markets.md | How Kalshi markets work |
Fuku预测 — 对话式Kalshi交易技能
通过对话进行预测市场交易。智能体了解您关心什么,构建个性化档案,然后在Kalshi市场中扫描符合您风格的机会。
三种模式
1. 档案构建(交互式)
用户描述偏好 → 智能体构建交易档案 → 保存以供重复使用。
2. 对话式扫描
智能体使用档案扫描市场 → 呈现匹配机会 → 用户批准交易。
3. 自主交易
智能体在风险限制内自动扫描和交易。
设置
依赖项
bash
pip install httpx cryptography python-dotenv
Kalshi API密钥
在技能目录中创建.env文件:
env
KALSHI
APIKEY
ID=yourkey_id
KALSHI
PRIVATEKEY=-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
获取凭证:https://kalshi.com/profile/api
定义偏好
用户用自然语言表达他们关心什么:
情境类: 我想要主场受让方在CBB中拿到7分以上 · 给我看大胜后的冷门机会 · 找到上次输15分以上的复仇战
球员不匹配: 最佳球员FPR差距超过50的比赛 · 明星球员受伤的对位
统计类: 仅限防守前30的比赛 · 节奏不匹配(快vs慢) · 让分差小于3分
风险与仓位: 最高信心比赛投5美元 · 每天最多8笔交易 · 四分之一凯利仓位
智能体工具
档案管理
bash
处理用户偏好输入
python3 scripts/agent_interface.py --input 我想要主场受让方在CBB中拿到7分以上
使用档案扫描
python3 scripts/agent_interface.py --scan --profile default
列出档案
python3 scripts/agent_interface.py --input 列出我的档案
市场浏览器
bash
今晚的市场,含预测和优势
python3 scripts/browse.py
按运动或比赛筛选
python3 scripts/browse.py --sport cbb
python3 scripts/browse.py --game 杜克 --date 2026-03-03
更改投注显示金额(默认5美元)
python3 scripts/browse.py --bet 10
直接Kalshi访问
bash
python3 scripts/kalshi_client.py balance
python3 scripts/kalshi_client.py positions
python3 scripts/kalshi_client.py markets --series KXNBASPREAD
向用户展示市场
始终包含: 市场、价格(美元)、模型预测、优势、回报和建议。
用美元而非合约交谈。 用户说在波士顿上5美元 — 内部转换为合约。
每种市场类型三级展示:
- - 主盘口 — 最接近50美分的合约(市场共识)
- 🔒 更安全 — 最高优势(高信心,中等回报)
- 🎰 更冒险 — 接近模型预测线(约50%模型概率,更大回报,要求≥3%优势)
优势图标: 🔥 ≥20% · ✅ ≥10% · 📊 ≥5% · ➖ <5%
示例:
🏀 波士顿 @ 密尔沃基 — 7:30 PM
📊 我们的模型:BOS -8.4 | 总分 224.1
• BOS -2.5 在50美分 → 70%模型(+20%优势 🔥)— 5美元回报10美元
↳ 🔒 更安全:BOS -1.5 在57美分 → 82%模型(+25%优势)— 5美元回报8美元
↳ 🎰 更冒险:BOS -8.5 在31美分 → 50%模型(+19%优势)— 5美元回报16美元
• 大分215.5 在52美分 → 79%模型(+27%优势 🔥)— 5美元回报9美元
💰 余额:$49.95
要我在这其中任何一个上下注吗?
美元到合约计算
在BOS -8.5上投5美元 在31美分 → floor($5 / $0.31) = 16份合约 × $0.31 = $4.96成本 → 如果YES则$16.00回报 → $11.04利润。
交易
python
from kalshi_client import KalshiClient
c = KalshiClient()
买入
c.place_order(ticker=KXNBA..., side=yes, action=buy,
count=16, order
type=limit, yesprice=31)
卖出退出
c.place_order(ticker=KXNBA..., side=yes, action=sell,
count=16, order
type=limit, yesprice=current_bid)
优势计算
正态分布概率转换(无需scipy):
- - 使用math.erfc计算CDF
- 运动特定σ:CBB让分12.0/总分11.0,NBA 11.0/10.5,NHL 1.5/1.3,足球1.2/1.1
- 球员道具:σ = 预测值的30%(最小2.0)
Kalshi市场结构
- - 系列(运动):KXNBASPREAD、KXNBATOTAL、KXNBAGAME
- 事件(比赛):KXNBASPREAD-26MAR02BOSMIL
- 市场(合约):KXNBASPREAD-26MAR02BOSMIL-BOS7 → 波士顿赢7.5分以上?
定价:YES/NO以美分计(1-99)。YES 31美分 = 31%隐含概率。1份合约 = 最高1美元回报。
支持的运动
| 运动 | 让分 | 总分 | 胜负 | 道具 |
|---|
| NBA | KXNBASPREAD | KXNBATOTAL | KXNBAGAME | — |
| CBB |
KXNCAAMBSPREAD | KXNCAAMBTOTAL | KXNCAABGAME | — |
| NHL | KXNHLSPREAD | KXNHLTOTAL | KXNHLGAME | 进球/得分/助攻 |
| 足球 | 按联赛(英超/西甲/意甲/德甲/法甲/欧冠/美职联) | 按联赛 | 按联赛 | 双方进球 |
自动驾驶配置
config/config.json:
json
{
strategy: model_follower,
sports: [nba, cbb],
minedgepct: 3.0,
maxdailyloss_pct: 10,
maxdailybets: 15,
sizing: quarter_kelly,
mode: approve
}
模式: dry_run(仅记录)· approve(询问用户)· auto(全自动)
安全
- - 每日最大亏损限制(默认10%)
- 仓位规模上限(默认每笔交易5%)
- 紧急停止:在技能目录中执行touch KILL_SWITCH
- 所有交易本地记录到trades.json
- API密钥永不离开机器
Kalshi API认证
RSA-PSS签名。客户端自动处理。
签名特性: 投资组合端点签名路径不含查询字符串。市场端点签名包含。参见kalshiclient.py中的SIGNPATHONLY。
Fuku预测API(公开)
基础URL:https://cbb-predictions-api-nzpk.onrender.com
| 端点 | 数据 |
|---|
| /api/public/cbb/predictions?date=YYYY-MM-DD | CBB预测 |
| /api/public/nba/predictions?date=YYYY-MM-DD |
NBA预测 |
| /api/public/nhl/predictions?date=YYYY-MM-DD | NHL预测 |
| /api/public/soccer/predictions?date=YYYY-MM-DD | 足球预测 |
| /api/public/cbb/rankings?limit=N | 球队FPR排名 |
| /api/public/cbb/players?team=X&limit=N | 球员FPR数据 |
文件
| 文件 | 用途 |
|---|
| scripts/browse.py | 主要 — 市场含预测、优势、回报 |
| scripts/agent_interface.py |
对话式档案构建+扫描 |
| scripts/profile_engine.py | 基于档案的机会评分