№ 015 · 2026-08-27 · shipped · docker-prod-01

A trading desk with one green button

claudealpacamcpfastapipwadockertrading

The ask sounded simple: “I want to say ‘buy me a fractional share of Tesla today’ and have it just happen.”

The interesting part is the last two words. “Just happen” is exactly the thing you don’t want an AI to do with a brokerage account. So the build became a question about where to put the human, and the answer turned out to be: one green button, on my phone, with everything else automated around it.

The broker

Alpaca gives you a developer-first brokerage: REST API, free paper-trading sandbox with fake money, and fractional orders down to a dollar — you POST a notional amount and get back 0.14 shares of whatever. The paper account is a full simulation of the real one, same API shapes, different hostname. That one-line difference between fake and real money is carrying a lot of weight, which informed everything below.

One brain, three faces

The trading logic lives in a single small service with one core module and three interfaces wrapped around it:

  1. A REST API — internal to the Docker network, token-gated on the LAN, never routed through the tunnel
  2. An MCP server — so Claude can quote, analyze, and trade the paper account conversationally (we later swapped this for Alpaca’s official MCP server, which shipped the same week — when the vendor maintains the integration, let them)
  3. A CLI — because everything here eventually gets a CLI

Every code path defaults to paper. Live mode is an explicit opt-in, and there’s a hard per-order dollar cap in the core module that no interface can bypass. Guardrails go in the one place all the doors lead to.

The phone part

On top of that sits a separate app: a password-gated PWA served through the tunnel on its own subdomain. Full-page dark UI, installable from Safari’s share sheet, and then it’s indistinguishable from a native app on the home screen — account card, live quote, amount chips, Buy/Sell with a confirm modal.

The feature that makes the whole thing work is the staged-order queue. I tell Claude, in a terminal, “buy $X of Tesla.” Claude doesn’t buy anything. It stages a proposal into a SQLite-backed queue, and a gold “Pending approval” card appears on my phone with three options: approve, edit, delete. Only the approve tap — my thumb, my phone, after a confirm modal — executes the order at the broker.

This split isn’t decoration. The AI does what AI is good at (parsing intent, checking quotes, staging a well-formed order) and the human does the one thing that should never be delegated: committing real money. The AI literally has no code path to approve its own suggestion.

Where it landed

The first real order went chat → staged → phone card → approve tap → accepted at the broker in about thirty seconds, most of which was me finding my phone. The market was closed, so the fill waits for the open — Claude scheduled itself a job to check the execution price in the morning.

Total stack: two small FastAPI services, one SQLite file, a phone icon, and a clean line between proposing and committing. That line is the product.