Cornerstone Guide

What is CLI Trading?

Coding agents have reached a tipping point. A CLI Trader is someone who commands AI agents to research, build strategies, and execute trades across every market — all from a single terminal session. No GUI, no spreadsheets, no context-switching. Just a human with a thesis and an agent that can think, code, and trade.

The Insight: Coding Agents Can Trade

Something fundamental shifted when coding agents got good enough to reliably use tools, reason through multi-step problems, and write working code on the fly.

AI agents like Claude Code, Cursor, and Windsurf were built to help developers write software. But what happens when you give a coding agent access to a brokerage CLI? Or connect it to a market data API through the Model Context Protocol? Or teach it a trading strategy through a Skill file?

It becomes a trading agent. One that can research fundamentals, scan for technical setups, backtest strategies, calculate position sizes, and submit orders — all from a conversation in your terminal.

A CLI Trader is someone who recognized this and built their trading workflow around it. They don't click buttons in a web interface. They command an agent, review its work, and approve execution. The agent handles the complexity; the human provides direction and judgment.


The Workflow: Command, Strategize, Approve, Execute

Every CLI Trading session follows the same fundamental pattern:

1. Command

You describe what you're thinking in natural language. This can be as vague as "I'm interested in biotech ahead of FDA season" or as specific as "Build me a delta-neutral iron condor on TSLA expiring in 14 days with max risk of $500." The agent understands both.

2. Strategize

The agent goes to work. It pulls market data using CLI tools and MCP connections. It researches the opportunity. It constructs a concrete strategy with entry points, position sizes, stop losses, and expected outcomes. If it has access to a relevant Skill, it applies domain-specific knowledge — like how biotech stocks historically behave around FDA catalysts, or how to structure options trades for earnings.

3. Approve

The agent presents its strategy and waits. You review the analysis, ask follow-up questions ("What if the FDA delays?", "What's the max loss scenario?"), and request changes. The human is always in the loop. Nothing executes without your explicit approval.

4. Execute

One confirmation and the agent submits the trade. It can set stops, alerts, and monitoring rules. From initial idea to live position — in minutes, not hours. And every step is logged in your terminal history, fully auditable.

Here's what this looks like in practice:

claude-code
 $ claude "I think biotech is setting up well ahead of
  FDA season. Find me the best risk/reward catalyst play."

> Scanning biotech FDA calendar (next 30 days)...
> Pulling options chains for 12 candidates...
> Analyzing IV rank vs historical catalyst moves...

--- TOP OPPORTUNITY ---
ACMR — PDUFA date: March 11
  Historical catalyst moves: avg ±18%
  Current IV30 implies ±12% — vol is cheap vs history
  Options flow: 3.2x call/put ratio (unusual)

Recommended strategy:
  Long $20/$25 call spread (Mar 14 expiry)
  Cost: $0.80 | Max gain: $4.20 | Breakeven: $20.80
  Risk/reward: 1:5.25

Approve this trade? [y/n] y

> Submitting order via tastytrade-cli...
✓ Order filled: ACMR Mar14 $20/$25 call spread × 10
✓ Alert set: notify if ACMR moves ±5% before PDUFA 

The trader described a thesis in one sentence. The agent scanned an entire sector, identified the best opportunity, structured a risk-defined trade, and executed it — all in a single terminal session.


Why the Terminal?

Andrej Karpathy — former OpenAI founding team member and Tesla AI Director — put it simply:

"The hottest new programming language is English... and the best environment to run agents in is the command line."

Andrej Karpathy

The terminal is the natural habitat for AI agents because it's text-in, text-out — exactly the interface LLMs operate in natively. There's no impedance mismatch. When you type a sentence and the agent responds with analysis and commands, that's the same medium the model thinks in.

But the deeper reason is access. The terminal is the universal API. Every brokerage, exchange, data provider, and financial service can be reached from a shell. Coding agents can install packages, run commands, read output, chain operations together, and write custom scripts on the fly. No other interface gives an agent this kind of unrestricted, composable access.

Financial markets are particularly well-suited to this paradigm. Market data is structured and queryable. Trading rules can be expressed as code. Risk management is arithmetic. The terminal doesn't just match how AI agents work — it matches how markets work.


The Agent's Toolbox: CLIs, MCPs, Skills

A coding agent in an empty terminal can reason about markets, but it can't do anything. The agent's power comes from the tools you give it. These fall into three categories:

CLIs — The Agent's Hands

Command-line interfaces are the direct action layer. Tools like the Polymarket CLI, tastytrade-cli, or ib_console let your agent place trades, fetch order books, manage positions, and interact with exchanges. When the agent runs polymarket markets list --sort volume, it's using its hands.

CLIs are powerful because of Unix composability. The agent can pipe the output of one command into another, chain operations, and build complex workflows from simple tools — exactly how software developers work.

MCPs — The Agent's Eyes and Ears

Model Context Protocol servers give the agent typed, reliable access to data and APIs. Where CLIs are general-purpose, MCPs are structured — the agent doesn't need to parse raw text output because MCP responses come with schemas. An Alpaca MCP connection gives the agent clean, validated access to stock data, options chains, and order submission.

MCPs reduce hallucination risk because the agent gets structured data, not scraped web pages. When market data arrives with types and schemas, there's less room for misinterpretation.

Skills — The Agent's Brain

Skills are domain expertise in a file. They teach the agent how to think about specific markets and strategies. Without a Skill, your agent is a generalist — smart but not specialized. Load a biotech catalyst Skill and it knows about PDUFA dates, historical approval rates, and how to structure binary event trades. Load a DeFi Skill like Uniswap AI Skills and it knows how to deploy liquidity positions and manage impermanent loss.

Skills are the abstraction that makes CLI Trading accessible to non-programmers. You don't need to teach your agent from scratch — you give it the right Skill and it has instant expertise.


Who is CLI Trading For?

The transformative insight is that CLI Trading works for every level of trader, not just technical users. The agent adapts to your sophistication:

  • Complete beginners — Tell your agent "I have $5,000 and want safe income." It will research conservative strategies, explain the risks in plain language, and only execute what you explicitly approve. The agent is simultaneously your analyst, your teacher, and your execution desk.
  • Intermediate traders — You have market views but limited time. Your agent scans for setups matching your criteria, backtests against historical data, and monitors positions while you do other things. You go from researching 2 ideas a week to 20 — all with better data.
  • Advanced professionals — You think in vol surfaces and cross-asset correlations. Your agent writes custom analytics, builds execution algorithms, and deploys strategies across multiple venues simultaneously. The CLI becomes your programmable trading infrastructure.

The common thread: you describe intent, the agent builds the strategy, you approve the execution. The sophistication of the output matches the sophistication of the input, but the workflow is the same.


Why This Is Happening Now

Several forces converged to make CLI Trading possible:

  • Coding agents crossed the threshold — LLMs can now reliably use tools, write and debug code, follow multi-step instructions, and maintain context over long analytical sessions. Claude Code, Cursor, and others aren't toys — they ship production software.
  • MCP standardization — Anthropic's Model Context Protocol gives agents a standard way to connect to data sources and APIs. Financial data providers are starting to ship MCP servers, which means agents get structured market access out of the box.
  • CLI-first brokerage APIs — Interactive Brokers, Alpaca, Tradier, and others now have command-line SDKs. The friction of executing trades from a terminal has dropped to near zero.
  • Retail data parity — Services like Polygon.io give individual traders the same data feeds that hedge funds use, accessible from the command line. The data advantage institutions had is shrinking fast.
  • Skills ecosystems — Platforms for packaging and sharing agent knowledge are emerging. A trader can publish a strategy as a Skill; other traders load it and their agent instantly has that expertise.

The cumulative result: a solo trader with a terminal and an AI agent can now research and execute with the analytical depth of a small institutional desk. The playing field hasn't been leveled — but it's tilting fast.


Getting Started

The fastest path from zero to your first CLI trade:

  1. Get an AI agent — Install Claude Code or any terminal-native AI agent. This is your orchestrator.
  2. Install one CLI tool — The Polymarket CLI is the easiest starting point. One brew install command.
  3. Talk to your agent — Open Claude Code and say "Show me what's happening on Polymarket." Watch it use the CLI for you.
  4. Go deeper — Connect an MCP server for stock data. Load a Skill for DeFi expertise. The toolbox grows with you.

Our step-by-step guide walks you through the full process: Your First CLI Trade: Safe Beginner Runbook (10-15 Minutes).


FAQ

Do you need to be technical to start?

Not necessarily. You can start with one tool, a few prompts, and strict execution guardrails. Technical depth helps later, but process discipline matters first.

Can CLI trading be used for longer-term workflows?

Yes. Many users apply it to research, screening, position review, and rule-based portfolio checks, not just short-term execution.

What is the most important safety practice?

Keep explicit human approval before execution and fixed risk caps per trade. This prevents most costly early mistakes.

Risk Disclaimer: Trading financial instruments involves substantial risk of loss. CLI Trading tools and AI agents are analytical aids, not financial advice. Always review agent-generated strategies carefully before approving execution. Never trade with money you cannot afford to lose.