## Why Trade Prediction Markets from the Terminal?
Prediction markets are finally mature enough to trade programmatically. Kalshi processes billions in volume, Polymarket dominates crypto-native event contracts, and a new wave of CLI tools makes it possible to scan, analyze, and execute from your terminal — no browser needed.
This matters because prediction markets move on information, not speed. The edge isn't in milliseconds of latency — it's in having a structured thesis and knowing when market prices diverge from your model. A good CLI tool makes that workflow fast and repeatable.
## The Landscape in 2026
### Raw Kalshi API
Kalshi's REST API (`api.elections.kalshi.com/trade-api/v2`) is well-documented and stable. You can fetch markets, place orders, and read your portfolio. Authentication uses RSA-PSS signing — not trivial to set up, but secure.
# Fetch a market directly
curl https://api.elections.kalshi.com/trade-api/v2/markets/KXRECSSNBER-26
**Pros:** Full control, no dependencies. **Cons:** You're building everything from scratch — signing, error handling, data formatting, edge detection logic.
### SimpleFunctions CLI
[SimpleFunctions](https://simplefunctions.dev) wraps the complexity into a single CLI:
npm install -g @spfunctions/cli
sf setup
sf scan "recession 2026"
What makes it different from a raw API wrapper:
- **Thesis engine**: `sf create "Oil stays above through 2026"` decomposes your thesis into a causal tree, scans both Kalshi and Polymarket for contracts where market prices diverge from thesis-implied values
- **Edge detection**: `sf edges` shows you the top mispriced contracts across all your theses, ranked by executable edge (theoretical edge minus spread)
- **Heartbeat monitoring**: Every 15 minutes, the server scans news, refreshes prices, and re-evaluates your thesis. You just read the output
- **Interactive agent**: `sf agent` gives you a natural language interface with 21+ tools — positions, orderbook analysis, what-if scenarios, trade execution
### Polymarket via API
Polymarket's API is less structured than Kalshi's. You're querying a CLOB (Central Limit Order Book) on Polygon. Tools like `py-clob-client` exist for Python, but there's no official CLI.
SimpleFunctions scans Polymarket markets during thesis formation and edge detection, so you get cross-venue coverage without managing two API integrations.
## Head-to-Head: What Matters
| Feature | Raw Kalshi API | SimpleFunctions CLI | Polymarket API |
|---------|---------------|-------------------|----------------|
| Setup time | Hours (RSA signing) | 2 minutes | Hours (wallet + CLOB) |
| Market scanning | Manual queries | `sf scan "keyword"` | Manual |
| Edge detection | Build yourself | Built-in | Build yourself |
| Orderbook analysis | Parse JSON yourself | `sf liquidity` | Parse yourself |
| Position tracking | GET /portfolio | `sf positions` with P&L | Manual |
| Automated monitoring | Build yourself | Heartbeat engine | Build yourself |
| Trading | POST /orders | `sf buy` with confirmation | Sign transactions |
| Agent mode | N/A | `sf agent` (21+ tools) | N/A |
| Cross-venue | Kalshi only | Kalshi + Polymarket | Polymarket only |
## Getting Started
If you're evaluating tools, start here:
# Install — no API key needed for scanning
npm install -g @spfunctions/cli
# Scan markets (free, no auth)
sf scan "oil recession iran"
# See what's liquid
sf liquidity --topic oil
# Full setup (API key for thesis features)
sf setup
The scan and liquidity commands work without any authentication — try them before committing to a key.
For the full agent guide, see the [SimpleFunctions documentation](https://simplefunctions.dev/docs/guide).
## When to Use What
**Use raw Kalshi API** if you're building a custom trading system with specific requirements the CLI can't meet, or if you need sub-second order execution.
**Use SimpleFunctions CLI** if you want thesis-driven trading with built-in edge detection, monitoring, and cross-venue scanning. It's the fastest path from "I have a macro view" to "I have positions that express it."
**Use Polymarket API** if you're specifically trading crypto-native event contracts and need on-chain settlement.
Most serious prediction market traders in 2026 are using a combination — SimpleFunctions for analysis and monitoring, with direct API access for custom execution logic when needed.