broker-cli

The trading CLI built for AI agents.

Connect to brokerages, manage portfolios, and execute strategies — from your terminal or from your agent's tool calls. Ships with SKILL.md so coding agents know how to use it out of the box.

$curl -fsSL brokercli.com/install | bash
GitHub ↗·Open Source·Python 3.12+
🤖

Agent-Native

Built for AI agents and coding assistants. Ships with SKILL.md so Codex, Claude Code, and other agents can trade autonomously.

Multi-Broker

Unified interface for E*Trade and Interactive Brokers. Switch providers without changing your code or agent prompts.

📊

Option Chains

Full option chain data with greeks, expiry filtering, and strike ranges. Built for derivatives strategies.

🎯

Exposure Analysis

Real-time portfolio exposure grouped by symbol, currency, sector, or asset class. Know your risk at a glance.

📋

Order Management

Place, monitor, and cancel orders. Bulk cancel-all for open orders when you need to flatten fast.

🔐

Persistent Auth

Headless re-authentication keeps sessions alive 24/7. No manual browser logins interrupting your agents.

Examples

Use from the command line, a Python script, or let your AI agent drive.

Command Line

# Start the daemon

$ broker daemon start

# View positions

$ broker portfolio

# Get AAPL call options expiring this month

$ broker option-chain AAPL --type call --expiry 2026-02

# Check exposure by symbol

$ broker exposure --by symbol

# Cancel all open orders

$ broker cancel-all

# Place a limit order

$ broker order buy AAPL 100 --limit 185.50

Python SDK

from broker_cli import Broker

broker = Broker()

# Get portfolio positions
positions = broker.portfolio()
for p in positions:
    print(f"{p.symbol}: {p.quantity} @ ${p.market_value:.2f}")

# Check exposure
exposure = broker.exposure(by="symbol")

# Flatten everything
broker.cancel_all()

AI Agent Integration

# broker-cli ships with SKILL.md — agents read it automatically
# Just point your agent at a trading task:

$ codex exec "Check my portfolio exposure. If any single position is >20% of NLV, reduce it to 15%."

# The agent reads SKILL.md, discovers broker-cli commands,
# checks exposure, and places orders to rebalance — autonomously.

Supported Brokers

FeatureInteractive BrokersE*Trade
Real-time quotes
Option chains
Market / limit / stop orders
Bracket orders
Cancel all
Positions & P/L
Exposure analysis
Streaming events
Persistent auth
Historical bars