Getting Started with the CLI
Install the Keel CLI and run your first command in under 60 seconds.
Getting Started
Install the Keel CLI and run your first command in under 60 seconds.
Install
pipx install keel-tradeRequires Python 3.11+. pipx installs the
keelCLI in an isolated environment. If you don't have pipx:brew install pipx(macOS) orpip install pipx.Alternatively, install in a virtual environment:
pip install keel-trade
Verify the installation:
keel --version
# keel, version 0.1.0
keel --helpLocal Tools (No API Key)
Most discovery and validation tools work locally — no account needed.
Search Components
# Find momentum indicators
keel components search --keyword momentum
# Natural language search
keel components search "mean reversion oscillator"
# Get full details for a component
keel components detail RSIValidate a Strategy
Create a strategy file my_strategy.py:
Globals(target_timeframe="1d")
Universe(mode="top_volume", top_n=30, market="perp", resolved=[], resolved_at="")
Pipeline([
PriceDataLoader(timeframe="15min"),
TargetTimeframeResampler(),
ROC(period=8),
ForecastScaler(avg_abs_target=10.0),
ForecastCapper(limit=20.0),
ForecastWeightNormalizer(target_leverage=1.0),
], name="my_momentum")# Validate
keel strategy validate my_strategy.py
# Check if it's ready to backtest
keel strategy stage my_strategy.py
# Explain the pipeline structure
keel strategy explain my_strategy.pyCreate from Template
# Create a new strategy from a template
keel strategy new my_strat --template momentum
# Available templates: basic, momentum, multi_factor, carryExplore Examples
# Browse curated examples
keel strategy examples
# Search for specific patterns
keel strategy examples --query "carry"
# Get composition guidance
keel strategy patterns "momentum with proper sizing"Remote Tools (API Key Required)
Backtesting, live trading, and platform features require authentication.
Authenticate
# Option 1: Environment variable (recommended for agents)
export KEEL_API_KEY=sk_org_xxx
# Option 2: Interactive login
keel auth login
# Verify
keel auth whoamiGet your API key from Settings → API Keys in the dashboard.
Run a Backtest
# Create strategy on platform
keel strategy create my_strategy.py
# Start backtest
keel backtest run str_abc123 --start-date 2025-01-01 --end-date 2025-12-31
# Check status
keel backtest status bt_xyz789
# Get results
keel backtest results bt_xyz789Deploy Live
# Deploy (requires confirmation)
keel live deploy str_abc123 --confirm
# Monitor
keel live positions dep_123
keel live pnl dep_123
keel live equity dep_123
# Emergency stop
keel live pause dep_123
keel live stop dep_123Output Formats
Every command supports --format:
# JSON (default in agent mode)
keel --format json components search --keyword ROC
# Table (default in terminal)
keel --format table backtest list
# TSV (half the tokens of JSON)
keel --format tsv components list
# Human-readable
keel --format human strategy explain my_strategy.pyThe CLI auto-detects agent mode (JSON output, no prompts) when it sees CLAUDE_CODE, CURSOR_AGENT, AIDER, or KEEL_AGENT_MODE environment variables, or when stdout is not a TTY.
Exit Codes
| Code | Meaning | What to Do |
|---|---|---|
| 0 | Success | Proceed |
| 1 | General failure | Check error message |
| 2 | Usage error | Fix arguments |
| 3 | Not found | Run keel <resource> list |
| 4 | Auth failed | Run keel auth login |
| 5 | Conflict | Resource already exists |
| 6 | Entitlement exceeded | Check keel auth status |
| 7 | Validation failed | Fix source, retry |
Next Steps
- CLI Reference — Complete command documentation
- Agent Setup — Configure Claude Code, Cursor, or custom agents