Keel Docs
SDK & CLI

CLI Reference

Complete reference for all keel CLI commands — component discovery, strategy tools, backtesting, live trading, and more.

CLI Reference

Complete reference for all keel commands. Commands are grouped by domain. Local commands work without an API key; remote commands require KEEL_API_KEY.

Global Options

keel [OPTIONS] COMMAND
  --format [json|table|tsv|human]   Output format (auto-detected)
  --dry-run                         Preview without side effects
  --verbose                         Verbose output
  --version                         Show version
  --help                            Show help

keel components — Component Discovery (local)

Search components by keyword, category, type, or natural language query.

keel components search --keyword momentum
keel components search --category indicator
keel components search --input-type SignalSeries --top-k 5
keel components search "oscillator for mean reversion"   # semantic search
OptionDescription
QUERYNatural language query (positional, optional)
--keywordCase-insensitive name/description match
--categoryFilter by category (indicator, signal_transform, forecast_mapper, etc.)
--sub-categoryFilter by sub-category
--input-typeFilter by required input type
--output-typeFilter by output type
--top-kMax results (default: 10)

detail

Get the full specification for a component — parameters, constraints, types, slots, and usage hints.

keel components detail ROC
keel components detail ForecastCombiner

after / before

Find type-compatible successors or predecessors for a component.

keel components after PriceDataLoader    # What can follow PriceDataLoader?
keel components before ForecastScaler    # What can precede ForecastScaler?

list

List all registered components, optionally filtered by category.

keel components list
keel components list --category indicator
keel components list --category data_loader

reference

Load DSL reference documentation.

keel components reference                # Table of contents
keel components reference phases         # Phase ordering rules
keel components reference types          # Type flow system
keel components reference slots          # Store/Load mechanics
keel components reference composition    # Composition patterns
keel components reference normalization  # Signal normalization
keel components reference best_practices # Strategy quality

keel strategy — Strategy Tools

Local Commands

new

Create a strategy from a template.

keel strategy new my_strat                        # Basic template
keel strategy new my_strat --template momentum    # Momentum template
keel strategy new my_strat --template multi_factor
keel strategy new my_strat --template carry

validate

Parse and validate a strategy. Returns issues, type flow, and pipeline summary.

keel strategy validate strategy.py
cat strategy.py | keel strategy validate -    # From stdin

Exits with code 7 if validation fails.

compile

Compile a strategy to executable artifacts. Returns fingerprint and step list.

keel strategy compile strategy.py

explain

Explain the structure — each step's types, parameters, slots, and validation status.

keel strategy explain strategy.py

diff

Structural diff between two strategies.

keel strategy diff before.py after.py

stage

Assess pipeline completeness. Reports stage (data/signal/forecast/sized), whether it's backtest-ready, and what's missing.

keel strategy stage strategy.py

Always run this before suggesting a backtest.

examples

Browse or search curated example strategies.

keel strategy examples
keel strategy examples --query "carry"
keel strategy examples --complexity simple
keel strategy examples --name simple_ewmac    # Full source

patterns

Query composition patterns by strategy goal.

keel strategy patterns "momentum with proper sizing"
keel strategy patterns "top 5 assets by performance"
keel strategy patterns "buy when RSI oversold"

lock-status / lock-upgrade

Check component version drift and upgrade.

keel strategy lock-status strategy.py
keel strategy lock-upgrade strategy.py
keel strategy lock-upgrade strategy.py --components ROC --components ForecastScaler

Remote Commands (require API key)

create / list / show / update

CRUD operations on platform strategies.

keel strategy create strategy.py              # Upload new strategy
keel strategy list                            # List all strategies
keel strategy list --search momentum          # Search
keel strategy show str_abc123                 # Get details
keel strategy update str_abc123 strategy.py   # Update source

versions / source / archive

Version management.

keel strategy versions str_abc123
keel strategy source str_abc123              # Latest source
keel strategy source str_abc123 v3           # Specific version
keel strategy archive str_abc123

keel universe — Universe Management

Local Commands

get / set

Read or update universe criteria on a strategy file.

keel universe get strategy.py
keel universe set strategy.py --mode manual --symbols BTC --symbols ETH --symbols SOL
keel universe set strategy.py --mode top_volume --top-n 30
keel universe set strategy.py --mode category --categories defi --categories l1

add-group / modify-group / remove-group

Manage asset groups for multi-group strategies.

keel universe add-group strategy.py large_cap --symbols BTC --symbols ETH
keel universe modify-group strategy.py large_cap --add SOL --remove ETH
keel universe remove-group strategy.py large_cap

Remote Commands (require API key)

keel universe resolve --mode top_volume --top-n 20    # Resolve to symbol list
keel universe categories                               # List categories
keel universe instruments --market perp                # List instruments

keel backtest — Backtesting (require API key)

keel backtest run str_abc123 --start-date 2025-01-01 --end-date 2025-12-31
keel backtest status bt_xyz789
keel backtest results bt_xyz789
keel backtest list
keel backtest list --strategy-id str_abc123 --limit 5

keel live — Live Trading (require API key)

keel live deploy str_abc123 --confirm    # Deploy
keel live list                           # List deployments
keel live show dep_123                   # Deployment details
keel live pause dep_123                  # Pause
keel live resume dep_123                 # Resume
keel live stop dep_123                   # Stop
keel live positions dep_123              # Current positions
keel live equity dep_123                 # Equity curve
keel live pnl dep_123                    # Daily P&L
keel live stats dep_123                  # Statistics
keel live weights dep_123                # Portfolio weights
keel live portfolio                      # Aggregate summary

keel auth — Authentication

keel auth login                 # Interactive (prompts for key)
keel auth login --key sk_xxx    # Non-interactive
keel auth logout                # Clear credentials
keel auth whoami                # Current identity + org
keel auth status                # Entitlements + active deployments

Credentials are stored in ~/.keel/config.yaml. The KEEL_API_KEY environment variable takes precedence.


keel market-data — Market Data (require API key)

keel market-data prices --symbols BTC --symbols ETH --start 2025-01-01 --end 2025-03-01 --timeframe 1d

keel mcp — MCP Server

keel mcp serve                              # stdio (Claude Code, Cursor)
keel mcp serve --transport http --port 3100 # HTTP (remote agents)

See Agent Setup for configuration details.


Stdin Support

Commands that accept a file also accept - for stdin:

# Pipe from another command
keel strategy source str_abc123 | keel strategy validate -

# Pipe from echo
echo 'Pipeline([ROC(period=8)], name="test")' | keel strategy stage -