Rust CLI for Kalshi's REST and WebSocket APIs with RSA-PSS auth.
- Human-friendly table output (
-o table) and machine-friendly JSON (-o json) - Config resolution: CLI flags > env vars > config file
- Public commands without auth (markets/events/trades/exchange)
- Auth-gated portfolio/order/watch commands with clear errors
- WebSocket streaming with NDJSON in JSON mode
- Interactive shell (
kal shell)
Reusable agent skills live in skills/ (one skill per command group). These are designed to be copied into any coding-agent skills directory.
skills/kal-markets/skills/kal-events/skills/kal-order/skills/kal-portfolio/skills/kal-trades/skills/kal-exchange/skills/kal-watch/skills/kal-config/skills/kal-shell/
Install in your agent of choice:
# Codex
cp -R skills/* ~/.codex/skills/
# Claude Code
cp -R skills/* ~/.claude/skills/
# OpenClaw (example path)
cp -R skills/* ~/.openclaw/skills/If your agent supports a custom skills path, you can point it directly at this repo instead of copying:
- Skills root:
~/projects/kalshi-cli/skills - Example strategy: set your agent's
skills_dir/skillsPathsetting to that path - Alternative: symlink your agent skills folder to this repo so updates stay in sync
# Example symlink approach (replace target for your agent)
ln -sfn ~/projects/kalshi-cli/skills ~/.codex/skills/kalshi-clicargo build --release
./target/release/kal --helpgit clone git@github.com:arekhalpern/kal-cli.git
cd kal-cli
cargo install --path . --bin kal --locked --force
kal --versionIf kal is not found in your current shell:
source ~/.cargo/env
hash -r
kal --versionOptional system-wide install:
cargo build --release
sudo install -m 0755 target/release/kal /usr/local/bin/kal
kal --version-o, --output <table|json>-e, --env <prod|demo>--api-key <key>--api-secret <path_or_inline_pem>
kal markets list- list markets with optional status/event filters (--status,--active,--event,--limit)kal markets get <TICKER>- get a single marketkal markets search <QUERY>- search markets by ticker/title (--days,--limit,--compact)kal markets top- top upcoming markets by open interest and total volume (--days,--min-open-interest,--min-total-volume,--active,--universe)kal markets orderbook <TICKER>- fetch orderbook snapshot (--depth)
kal events list- list events (--status,--series,--with-markets)kal events get <TICKER>- get one event (--with-markets)kal events top- top upcoming events by aggregated open interest and total volume (--days,--min-open-interest,--min-total-volume,--active,--universe)
kal order create <TICKER>- place order (--side,--action,--count,--price,--type,--tif)kal order cancel <ORDER_ID>- cancel one orderkal order cancel-all- cancel all resting orders (--tickeroptional scope)kal order amend <ORDER_ID>- amend order (--price,--count)kal order list- list account orders (--ticker,--status)kal order get <ORDER_ID>- fetch one order
kal portfolio balance- account balance summarykal portfolio positions- list positions (--ticker,--event,--settled,--unsettled)kal portfolio fills- recent fills (--ticker,--days)kal portfolio settlements- recent settlements (--ticker,--days)
kal trades list- public market trades (--ticker,--limit)
kal exchange status- current exchange statuskal exchange schedule- exchange trading schedulekal exchange announcements- exchange announcements
kal watch ticker <TICKER>- stream ticker updates (--tickerscomma-separated for multi-market)kal watch orderbook <TICKER>- stream orderbook deltaskal watch trades <TICKER>- stream real-time trades
kal config setup- interactive config wizardkal config show- show current config (masked)kal config path- print config file pathkal config reset- delete config with confirmation
kal shell- interactive REPL for running CLI commands
Set KALSHI_ENV (or use --env) to choose API environment:
prod(default):https://api.elections.kalshi.com/trade-api/v2demo:https://demo-api.kalshi.co/trade-api/v2
Kalshi’s demo and production environments use separate accounts/credentials.
Per Kalshi docs, for authenticated requests:
- Log in to your Kalshi account (demo or prod)
- Go to Account & security -> API Keys
- Click Create Key
- Save both values:
- API Key ID
- Private key (
.key/ PEM)
Important: the private key cannot be retrieved again after creation. Store it securely.
You can configure credentials via kal config setup, CLI flags, or environment variables.
Environment variable example:
export KALSHI_ENV=prod
export KALSHI_API_KEY='your_api_key_id'
export KALSHI_API_SECRET='/absolute/path/to/kalshi-private-key.pem'Then test:
kal exchange status
kal portfolio balanceNote: this CLI does not auto-load .env by itself. To load a local .env file in bash:
set -a
source .env
set +aConfig path:
- Linux/macOS:
~/.config/kalshi-cli/config.json
Stored format:
{
"api_key": "abc123",
"api_secret_path": "/path/to/key.pem",
"environment": "prod"
}Config file permissions are set to owner-only on Unix (0600).
Kalshi documentation:
- Quick Start (Authenticated Requests): https://docs.kalshi.com/getting_started/quick_start_authenticated_requests
- Demo environment: https://docs.kalshi.com/getting_started/demo_env
- Quick Start (Market Data / production base URL): https://docs.kalshi.com/getting_started/quick_start_market_data
kal exchange status
kal markets list --status open --limit 5
kal markets list --limit 5 -o json
kal config setup
kal portfolio balance
kal watch ticker KXBTC-24DEC31-B100K -o json
kal shell