kalshi/bot/SKILL.md
Autonomous trading agent for Kalshi prediction markets using Seren ecosystem
npx skillsauth add serenorg/seren-skills botInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Autonomous trading agent for Kalshi prediction markets integrating the Seren ecosystem.
READ THIS BEFORE USING
Activate this skill when the user mentions:
Immediately run a dry-run scan without asking. Do not present a menu or ask the user to choose between scan/trade/setup. Execute the paper scan by default. Only after results are displayed, present available next steps (live trading setup, position management). If the user explicitly requests a specific action in their invocation message, run that action instead.
When the user asks to scan Kalshi or find trading opportunities, run the bot:
First, verify the skill is set up:
ls ~/.config/seren/skills/kalshi-bot/.env ~/.config/seren/skills/kalshi-bot/config.json
If files are missing, guide user through setup (see Phase 1-2 below).
Run a single scan to find mispriced markets:
cd ~/.config/seren/skills/kalshi-bot && python3 scripts/agent.py --config config.json --dry-run 2>&1
What this does:
How to present results to user:
Found 3 opportunities:
| Market | Side | Price | Fair Value | Edge | Contracts | EV |
|--------|------|-------|------------|------|-----------|----|
| KXBTC-25APR-T100K | YES | 54c | 67% | 13% | 11 | $1.43 |
| KXFED-25MAY-RATE | NO | 40c | 28% | 12% | 8 | $0.96 |
Only if user has:
cd ~/.config/seren/skills/kalshi-bot && python3 scripts/agent.py --config config.json --yes-live --once
cd ~/.config/seren/skills/kalshi-bot && python3 scripts/setup_cron.py create --config config.json --schedule "0 */2 * * *" --dry-run
Then start the local pull runner:
python3 scripts/run_local_pull_runner.py --config config.json
When the user gives a direct exit instruction (sell, close, exit, unwind, flatten), execute the exit path immediately.
Do not editorialize or argue against recovering remaining funds.
If the user request is ambiguous, ask only the minimum clarifying question needed to identify the positions to exit.
KalshiClient in scripts/kalshi_client.pyKALSHI-ACCESS-KEY, KALSHI-ACCESS-SIGNATURE, KALSHI-ACCESS-TIMESTAMPBefore any live buy, sell, or unwind:
Default mode is --dry-run. Live trading requires:
python scripts/agent.py --config config.json --yes-live--live flagThe --yes-live flag is a startup-only live opt-in. It is not a per-order approval prompt.
This skill helps users set up and manage an autonomous trading agent that:
Pure Python Implementation
scripts/agent.py locallyComponents:
scripts/agent.py - Main trading loop (three-stage pipeline)scripts/seren_client.py - Seren API client (calls publishers)scripts/kalshi_client.py - Kalshi REST API client with RSA signingscripts/setup_cron.py - seren-cron local-pull schedule managementscripts/run_local_pull_runner.py - Local seren-cron polling runnerscripts/kelly.py - Kelly Criterion position sizingscripts/position_tracker.py - Position and P&L managementscripts/logger.py - Trading logger (JSONL)scripts/risk_guards.py - Drawdown, aging, and auto-pause guardsSeren Publishers Used:
perplexity - Perplexity AI research (via OpenRouter)
sonar for fast researchseren-models - Multi-model LLM inference (via OpenRouter)
anthropic/claude-sonnet-4.5seren-cron - Autonomous local-pull scheduling
scripts/agent.py locallyKalshi REST API (direct):
https://api.elections.kalshi.com/trade-api/v2GET /markets, GET /markets/{ticker}, GET /markets/{ticker}/orderbookGET /events, GET /events/{event_ticker}POST /portfolio/orders, DELETE /portfolio/orders/{order_id}GET /portfolio/positions, GET /portfolio/balanceGET /portfolio/fillsBefore running this skill, check for an existing Seren API key in this order:
API_KEY automatically. Check: echo $API_KEY. If set, no further action needed..env file -- check if SEREN_API_KEY is already set. If set, no further action needed.SEREN_API_KEY is exported. If set, no further action needed.Only if none of the above are set, register a new agent account:
curl -sS -X POST "https://api.serendb.com/auth/agent" \
-H "Content-Type: application/json" \
-d '{"name":"kalshi-bot"}'
Extract the API key from .data.agent.api_key -- shown only once. Write it to .env:
SEREN_API_KEY=<the-returned-key>
Do not create a new account if a key already exists. Creating a duplicate results in a $0-balance key.
cd kalshi/bot
# Check Python version (need 3.10+)
python3 --version
# Install dependencies
pip3 install -r requirements.txt
cp .env.example .env
Edit .env:
# Seren API key
SEREN_API_KEY=your_seren_api_key_here
# Kalshi API credentials (from https://kalshi.com/account/api)
KALSHI_API_KEY=your_kalshi_api_key_here
KALSHI_PRIVATE_KEY_PATH=/path/to/kalshi_private_key.pem
How to get Kalshi API credentials:
KALSHI_API_KEY and KALSHI_PRIVATE_KEY_PATH in .envSecurity Note:
.env to gitcp config.example.json config.json
Edit config.json:
{
"bankroll": 100.0,
"mispricing_threshold": 0.08,
"max_kelly_fraction": 0.06,
"max_positions": 10
}
Parameter Guide:
Total capital available for trading (in USD).
Minimum edge required to trade (as decimal).
Maximum percentage of bankroll per trade.
Quarter-Kelly is applied automatically (raw Kelly / 4).
python3 scripts/agent.py --config config.json --dry-run
python3 scripts/agent.py --config config.json --yes-live --once
Create a cron schedule:
python3 scripts/setup_cron.py create --schedule "0 */2 * * *" --dry-run
Start the local runner:
python3 scripts/run_local_pull_runner.py --config config.json
Manage schedules:
python3 scripts/setup_cron.py list
python3 scripts/setup_cron.py pause --job-id <id>
python3 scripts/setup_cron.py resume --job-id <id>
python3 scripts/setup_cron.py delete --job-id <id>
Set SEREN_API_KEY in .env or ensure API_KEY is injected by Seren Desktop.
Set KALSHI_PRIVATE_KEY_PATH in .env pointing to your RSA private key PEM file.
API key or RSA signature is invalid. Re-generate credentials at kalshi.com/account/api.
Kalshi API may be down, or all markets are filtered out. Check your min_volume and min_open_interest settings.
Each scan costs ~$1 in SerenBucks (Perplexity research + Claude inference). Top up at console.serendb.com.
Q: How much does it cost to run? A: ~$1 in SerenBucks per scan cycle (Perplexity + Claude calls). Scans every 2 hours = ~$12/day.
Q: What is the minimum bankroll? A: $50 recommended for paper trading. $100+ for live trading.
Q: How does pricing work on Kalshi? A: Prices are in CENTS (1-99). A YES contract at 54c costs $0.54 and pays $1.00 if the event occurs. A NO contract at 46c (100 - 54) costs $0.46 and pays $1.00 if the event does not occur.
Q: Is this legal? A: Kalshi is a CFTC-regulated exchange. Check your local regulations regarding event contracts.
Q: Can I lose more than my bankroll? A: No. Kalshi contracts have limited risk. Maximum loss per contract is the purchase price.
testing
Review-first outreach skill for the default Seren Bucks affiliate program. It bootstraps affiliate context via /programs/discover, mines sent-mail history and address books for candidates, persists them into a skill-owned CRM, proposes an editable daily top-10, drafts outbound and reply batches for approval, reconciles affiliate and reply signals, enforces hard DNC, and returns a manual daily digest.
data-ai
Lean partner-link distribution skill for the seren-affiliates publisher program portfolio. Operates one publisher program per run. Bootstraps the affiliate profile (registering on first run), caches joined programs in serendb, ingests contacts from a pasted list or from Gmail/Outlook address books, drafts a pitch once per run via seren-models for operator approval, sends approved copy through Gmail (preferred) or Microsoft Outlook, enforces per-program dedupe plus a global unsubscribe list, and reports local plus live conversion and commission stats from seren-affiliates.
development
Family office: Process an incoming GP capital call notice end-to-end — confirm, fund, log, reconcile.
development
Work with Seren Bounty affiliate bounties: customers create and fund verifier-backed bounties; agents join to receive a referral_code and accrue earnings as qualifying events are verified; a release sweep pays matured earnings out of escrow.