Build a custom OpenClaw skill that gives your agent real-time Kalshi event contract prices, order book depth, and trade history. One SKILL.md file, an API key, and your agent can monitor prediction market contracts across sports, politics, economics, and weather.

Why Your Agent Needs a Kalshi Tracker

Kalshi is the first CFTC-regulated prediction market exchange in the United States. It lists event contracts on everything from sports outcomes to economic indicators to weather events — and every contract trades as a binary between $0.01 and $0.99.

For an autonomous betting agent, Kalshi represents a regulated, liquid source of probability pricing that often diverges from traditional sportsbook odds. When a Kalshi “Will the Lakers win tonight?” contract trades at $0.45 while DraftKings has the Lakers moneyline at +130 (implied 43.5%), that gap is a signal — and your agent can only see it if it has eyes on both markets.

This guide builds kalshi-tracker — a Layer 3 (Trading) skill that handles Kalshi market surveillance as part of the Agent Betting Stack. The skill fetches contract prices via the Kalshi Public API, converts them to American odds for cross-platform comparison, and monitors order book depth so your agent can assess liquidity before flagging opportunities.

What You’re Building

The kalshi-tracker skill teaches your OpenClaw agent five operations:

  1. List events by category — Browse active Kalshi markets across sports, politics, economics, and more
  2. Get contract prices — Current Yes/No prices, bid/ask spread, and volume for any event
  3. Convert to American odds — Transform Kalshi contract prices into American odds for sportsbook comparison
  4. Check order book depth — Assess liquidity by viewing resting orders at each price level
  5. Fetch recent trades — See the last trades executed on a contract for momentum analysis

The skill uses curl and jq — no Python runtime required for core operations. The odds conversion operation uses an inline python3 -c command for clean formatting.

Prerequisites

  • OpenClaw installed and running — Any channel (WhatsApp, Telegram, Discord, WebChat)
  • Kalshi API key — Create an account at kalshi.com and generate an API key from your account settings
  • curl and jq — Pre-installed on macOS and most Linux distributions
  • python3 — Required only for the odds conversion operation (pre-installed on macOS and most Linux)

The Math Behind Contract Price Conversion

Kalshi contracts trade as a price between $0.01 and $0.99, which directly represents the market’s implied probability. Converting to American odds:

For favorites (probability > 50%, contract price > $0.50):

American odds = -(price / (1 - price)) × 100
Example: $0.75 contract → -(0.75 / 0.25) × 100 = -300

For underdogs (probability < 50%, contract price < $0.50):

American odds = +((1 - price) / price) × 100
Example: $0.30 contract → +(0.70 / 0.30) × 100 = +233

For even money (price = $0.50):

American odds = +100 / -100 (pick 'em)

This conversion lets your agent compare a Kalshi contract directly against a sportsbook moneyline — the foundation of cross-market arbitrage detection.

The Complete SKILL.md

Create the skill directory:

mkdir -p ~/.openclaw/skills/kalshi-tracker

Create ~/.openclaw/skills/kalshi-tracker/SKILL.md with this content:

---
name: kalshi-tracker
description: "Track Kalshi event contract prices, order book depth, and recent trades. Covers sports, politics, economics, and weather markets. Converts contract prices to American odds for cross-platform comparison. Read-only — no trade execution."
metadata:
  openclaw:
    emoji: "📈"
    requires:
      bins: ["curl", "jq"]
    credentials:
      - id: "kalshi-api-key"
        name: "Kalshi API Key"
        description: "API key from your Kalshi account at https://kalshi.com/"
        env: "KALSHI_API_KEY"
---

# Kalshi Event Contract Tracker

Monitor Kalshi prediction market contracts — prices, order books, and trade history.

# When to Use

Use this skill when the user asks about:
- Kalshi market prices or event contracts
- Prediction market odds for sports, politics, economics, or weather
- Order book depth or liquidity on Kalshi
- Converting Kalshi contract prices to American odds
- Recent trades or volume on a Kalshi market
- Comparing Kalshi prices against sportsbook odds

# Event Categories

Common Kalshi event categories:

| Category | Series Prefix | Examples |
|----------|--------------|----------|
| Sports | SPORTS- | NBA winners, NFL spreads, World Cup |
| Politics | POL- | Elections, policy decisions |
| Economics | ECON-, FED- | GDP, inflation, Fed rate decisions |
| Weather | WEATHER- | Temperature records, hurricane landfalls |
| Finance | FINANCE- | Stock prices, crypto prices |
| Entertainment | ENT- | Award show winners, box office |

# Operations

### 1. List Active Events

Browse events with optional category filtering:

```bash
curl -s "https://api.elections.kalshi.com/trade-api/v2/events?status=open&limit=50" \
  -H "Authorization: Bearer $KALSHI_API_KEY" \

  | jq '[.events[] | {

    ticker: .event_ticker,
    title: .title,
    category: .category,
    markets_count: (.markets | length),
    volume: .volume
  }] | sort_by(-.volume) | .[:20]'
```

To filter by category (e.g., sports):

```bash
curl -s "https://api.elections.kalshi.com/trade-api/v2/events?status=open&limit=50&series_ticker=SPORTS" \
  -H "Authorization: Bearer $KALSHI_API_KEY" \

  | jq '[.events[] | {

    ticker: .event_ticker,
    title: .title,
    markets_count: (.markets | length),
    volume: .volume,
    close_time: .close_time
  }] | sort_by(-.volume)'
```

### 2. Get Contract Prices

Fetch current Yes/No prices, volume, and status for a specific event's markets. Replace EVENT_TICKER with the event ticker from operation 1:

```bash
curl -s "https://api.elections.kalshi.com/trade-api/v2/events/EVENT_TICKER" \
  -H "Authorization: Bearer $KALSHI_API_KEY" \

  | jq '{

    event: .event.title,
    category: .event.category,
    markets: [.event.markets[] | {
      ticker: .ticker,
      subtitle: .subtitle,
      yes_price: (.yes_bid // "no bid"),
      no_price: (.no_bid // "no bid"),
      yes_ask: (.yes_ask // "no ask"),
      no_ask: (.no_ask // "no ask"),
      last_price: .last_price,
      volume: .volume,
      open_interest: .open_interest,
      status: .status,
      close_time: .close_time
    }]
  }'
```

### 3. Convert Contract Prices to American Odds

After fetching prices, convert to American odds for sportsbook comparison:

```bash
curl -s "https://api.elections.kalshi.com/trade-api/v2/events/EVENT_TICKER" \
  -H "Authorization: Bearer $KALSHI_API_KEY" \

| jq -r '.event.markets[] | "\(.subtitle)\t\(.last_price)"' \ |
| python3 -c "            |                                   |

import sys
for line in sys.stdin:
    parts = line.strip().split('\t')
    if len(parts) != 2:
        continue
    name, price_str = parts
    try:
        price = float(price_str) / 100
    except (ValueError, TypeError):
        print(f'{name}: no price available')
        continue
    if price <= 0 or price >= 1:
        print(f'{name}: {price_str}c (off the board)')
    elif price > 0.5:
        odds = -(price / (1 - price)) * 100
        print(f'{name}: {price_str}c → {int(odds):+d} (implied {price:.1%})')
    elif price < 0.5:
        odds = ((1 - price) / price) * 100
        print(f'{name}: {price_str}c → +{int(odds)} (implied {price:.1%})')
    else:
        print(f'{name}: {price_str}c → +100/-100 (implied 50.0%)')
"
```

### 4. Check Order Book Depth

View resting orders to assess liquidity for a specific market. Replace MARKET_TICKER with the market ticker from operation 2:

```bash
curl -s "https://api.elections.kalshi.com/trade-api/v2/markets/MARKET_TICKER/orderbook" \
  -H "Authorization: Bearer $KALSHI_API_KEY" \

  | jq '{

    ticker: .ticker,
    yes_orders: [.orderbook.yes[]? | "price: \(.[0])c  qty: \(.[1])"],
    no_orders: [.orderbook.no[]? | "price: \(.[0])c  qty: \(.[1])"],
    spread: ((.orderbook.yes[0]?[0] // 0) + (.orderbook.no[0]?[0] // 0) - 100),
    depth_yes_top3: ([.orderbook.yes[:3]?[]?[1]] | add // 0),
    depth_no_top3: ([.orderbook.no[:3]?[]?[1]] | add // 0)
  }'
```

### 5. Fetch Recent Trades

See the last trades executed on a market for momentum and volume analysis:

```bash
curl -s "https://api.elections.kalshi.com/trade-api/v2/markets/MARKET_TICKER/trades?limit=20" \
  -H "Authorization: Bearer $KALSHI_API_KEY" \

  | jq '[.trades[] | {

    time: .created_time,
    price: .yes_price,
    count: .count,
    taker_side: .taker_side
  }]'
```

# Output Rules

1. Always show the event title, market subtitle, and contract ticker
2. Show contract prices in cents (e.g., 45c for $0.45)
3. When showing American odds conversion, include both the cent price and the converted odds
4. For order books, report the bid/ask spread and top-3 depth on each side
5. Flag markets with fewer than 5 contracts of top-of-book depth as "thin liquidity"
6. Flag markets with bid/ask spread > 10c as "wide spread — use limit orders"
7. Always show volume and open interest for context
8. Note the market close time so the agent knows time-to-expiry

# Error Handling

- If KALSHI_API_KEY is not set, tell the user to create a Kalshi account at https://kalshi.com/ and generate an API key
- If the API returns 401, the API key may be expired — suggest regenerating it
- If an event ticker returns empty markets, the event may have settled or been delisted
- If rate limited (429), wait 60 seconds before retrying
- If order book is empty, the market may be halted or near expiry

Set Your API Key

export KALSHI_API_KEY=your_key_here

Add to your shell profile (~/.zshrc, ~/.bashrc) so it persists across sessions:

echo 'export KALSHI_API_KEY=your_key_here' >> ~/.zshrc

OpenClaw reads environment variables from the host process, so the key is available to the skill automatically.

Test It

Restart OpenClaw (or wait for hot-reload if your version supports it), then try these prompts:

PromptExpected Behavior
“Show Kalshi sports markets”Lists active sports events sorted by volume
“What’s the Kalshi price on the Super Bowl?”Fetches contract prices for the Super Bowl event
“Convert Kalshi prices to American odds for the election”Shows contract prices with American odds equivalents
“Check liquidity on that market”Displays order book depth, spread, and top-3 resting quantity
“Recent trades on MARKET_TICKER”Lists the last 20 trades with price, quantity, and taker side
“Compare Kalshi vs sportsbook odds on the NBA Finals”Converts Kalshi price to American odds for direct comparison

Your agent reads the SKILL.md, identifies the relevant operation, substitutes the right event or market ticker, and runs the curl + jq pipeline.

How It Works Under the Hood

OpenClaw skills are not plugins that execute code directly. The SKILL.md is a set of instructions that the LLM (Claude, GPT, etc.) reads and follows at runtime.

When you ask “what are Kalshi odds on the election,” this is what happens:

User message → OpenClaw Gateway
  → LLM reads system prompt + active skills
  → LLM matches "Kalshi odds" to kalshi-tracker skill
  → LLM generates curl command with appropriate event ticker
  → OpenClaw executes command via shell tool
  → JSON response piped through jq
  → LLM formats output for user (with odds conversion if requested)

The quality of your SKILL.md directly determines how reliably the agent picks the right operation and formats the output. The kalshi-tracker skill uses explicit operation names, exact curl commands, and strict output rules to minimize agent improvisation.

Extending the Skill

Add Cron-Based Price Alerts

OpenClaw supports cron jobs. Add a scheduled task that monitors a specific Kalshi market and alerts you when the price moves more than 5 cents:

{
  "cron": "*/15 * * * *",
  "prompt": "Check the Kalshi market MARKET_TICKER. If the Yes price has moved more than 5 cents since the last check, alert me on Telegram with the old price, new price, and direction."
}

This turns passive contract monitoring into proactive price-movement alerts — essential for time-sensitive prediction market trading.

Chain with Other Skills

The kalshi-tracker outputs structured data that downstream skills can consume:

  • odds-converter — Normalizes Kalshi cent prices into the same format as sportsbook odds for unified display
  • cross-market-pricer — Combines Kalshi prices with Polymarket and sportsbook odds for the same event, enabling apples-to-apples comparison
  • arb-finder — Compares Kalshi contract prices against sportsbook moneylines and Polymarket positions to find cross-market arbitrage
  • ev-calculator — Takes your true probability estimate, compares against Kalshi’s implied probability to calculate expected value

This is the power of the Agent Betting Stack — composable skills where each layer feeds the next.

Full Skill Series

This guide is part of the AgentBets OpenClaw Skills series. We’re building a complete library of betting-specific OpenClaw skills that map to the four layers of the Agent Betting Stack:

  • Layer 1 — Identity: Agent reputation tracking via Moltbook
  • Layer 2 — Wallet: Bankroll management, balance checking across platforms
  • Layer 3 — Trading: Odds scanning, Polymarket monitoring, Kalshi tracking (this guide), arbitrage detection
  • Layer 4 — Intelligence: EV calculation, Kelly sizing, CLV tracking, news sentiment

Each skill is a standalone SKILL.md you can install independently or compose into a full autonomous betting pipeline.

What’s Next