explaingit

pashpashpash/schwab-cli

24RustAudience · developerComplexity · 2/5Setup · moderate

TLDR

A command-line tool written in Rust that connects to Charles Schwab's brokerage API, letting you check balances, view positions, stream real-time market data, and place trades safely from a terminal, shell script, or AI agent.

Mindmap

mindmap
  root((schwab-cli))
    What it does
      Check balances
      View positions
      Stream market data
      Place orders safely
    Safety design
      Two-step live trading
      Environment variable gate
      Preview orders first
    Output format
      JSON to stdout
      Diagnostics to stderr
      Agent compact mode
    Limitations
      No Treasury bonds
      No CDs or ladders
      Use Schwab site for those
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Query your Schwab account balance, positions, and transaction history directly from the terminal or inside automated shell scripts.

USE CASE 2

Stream real-time market quotes and option chain data from Schwab's API into other programs by piping the JSON output.

USE CASE 3

Give an AI agent structured brokerage data access using the --agent mode compact JSON output.

USE CASE 4

Preview and safely place orders from the command line using the two-step safety mechanism that prevents accidental trade submission.

Tech stack

Rust

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a Charles Schwab developer account and completing an OAuth login flow to generate and store credentials locally.

No license information is mentioned in the explanation.

In plain English

This tool is a command-line program that connects to Charles Schwab's brokerage trading API. It is written in Rust and designed to be used from a terminal, by automated scripts, or by AI agents that need to read or act on brokerage data. The project has no affiliation with Charles Schwab. Once installed and connected to your Schwab developer account through a standard login flow called OAuth, you can run commands to check account balances, list positions, pull transaction history, get market quotes for specific stock symbols, view option chains, and look at price history for a stock. It also supports streaming real-time market data directly to your terminal. A notable design choice is how it handles live order placement. Placing, replacing, or canceling a real order requires two separate safety steps: setting an environment variable called SCHWAB_CLI_ALLOW_LIVE_TRADING and also passing a flag called --yes-live-order on the same command. Previewing an order, by contrast, has no such barrier and is encouraged as a first step. This makes it harder to accidentally submit a trade. The tool outputs data as JSON to the standard output channel and sends diagnostic messages to a separate channel, which makes it easy to pipe the output into other programs or store it in files. There is also an --agent mode that produces more compact output for AI tools reading the results programmatically. Installation is a single shell command that downloads the latest release to a folder in your home directory. The tool stores its credentials and account data in configuration files on your local machine, outside the repository, so that sensitive information like OAuth tokens is never accidentally committed to version control. The README notes that Schwab's API does not expose all account types visible on the Schwab website. Certain products like Treasury bonds, CDs, and fixed-income ladders may require using the Schwab website directly even after setting up this tool.

Copy-paste prompts

Prompt 1
I installed pashpashpash/schwab-cli. Walk me through the OAuth setup steps to connect it to my Schwab developer account and store credentials locally.
Prompt 2
Using schwab-cli, write a shell script that fetches my current positions and prints a table of each holding with its current market value.
Prompt 3
I want to use schwab-cli with an AI agent. Show me how to use --agent mode and pipe its JSON output into a Python script that summarizes my portfolio allocation.
Prompt 4
How do I safely preview an order with schwab-cli before submitting a live trade? Show the exact command sequence including how to set the required environment variable.
Open on GitHub → Explain another repo

← pashpashpash on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.