Work / Data & AI In development
Tradeline — Approval-Gated AI Trading Agent
An AI analyst that researches the market and proposes trades against my own risk rules, while I approve or reject every buy from my phone. Exits I approved are carried out automatically, deterministic guardrails sit between the model and the broker, and the whole system runs on a private server I reach over Tailscale.
- Role
- Designer and product owner
- Period
- 2026 – present
- Type
- AI agent · Trading dashboard · Always-on service
- Stack
- Python, Anthropic API, Alpaca API, Streamlit, SQLite, pytest, systemd, Tailscale, ntfy
- Links
- Demo
Problem
I wanted an assistant that trades the way I would: inside my risk tolerance, in the sectors I follow, with a fixed budget it can't exceed. I also wanted to stay the decision-maker. Fully autonomous trading bots hand an LLM the keys to an account, and an LLM that reads one stale price can place a confident, wrong order.
So the brief was a split: the model does the reading and the proposing, I do the approving, and code that doesn't think enforces the limits on both of us.
Approach
I chose Alpaca over a brokerage with a built-in AI integration because I wanted control over the whole design: where the approval gate lives, what the model can see, and what happens after an order fills. Everything starts on paper money.
- The analyst proposes; it can't trade. It's a Claude tool-use loop that reads the portfolio, prices, intraday bars and news, then ends by submitting a list of proposals. It's handed a read-only broker object that has no order methods at all, so the separation holds by construction rather than by instruction.
- Every buy carries an exit plan. Each proposal includes a take-profit and a stop-loss. I can accept the agent's levels with one click or edit them before approving.
- I approve each buy. Proposals wait in a queue. Approve sends a limit order; Reject asks for a reason, and the agent reads my reasons on its next run.
- Guardrails are plain code. Budget, per-position cap, maximum positions, banned symbols, limit price near the last trade, stop distance, and never selling more than I hold. They run when the agent proposes and again right before an order is sent.

Architecture
Analyst (Claude) Guardrails Executor
read-only broker ──▶ plain Python ──▶ sends a limit order
proposes + exit plan checks, twice only on my click
│ │
▼ ▼
SQLite ◀──────────── worker (systemd) ─────────▶ Alpaca
proposals, decisions, exits, scheduled runs,
runs, news, snapshots news, snapshots, backups
│
▼
Streamlit dashboard ──▶ phone / laptop over Tailscale · push via ntfy
The dashboard and the worker share one SQLite file. The worker is the only process that acts without me, and it can only sell, only shares I hold, and only to carry out an exit plan I already approved. A kill switch blocks new buys while leaving those exits on.
Key features
- Exit autopilot in two layers. Alpaca accepts stop orders on fractional shares only as day orders, so the worker places a fresh broker-side stop each session (protection even if the server is down) and watches prices every few minutes to take profit at the target.
- Memory of its own runs. Each run is logged with its transcript, and the next run starts from short digests of the last few: what it said, what it proposed, and what I did with each proposal. Full transcripts never go back into the context, which keeps cost flat.
- A news pool tied to the portfolio. Headlines for my holdings, watchlist and sector ETFs are scored by a small model in one batch call. I can pin an article to the next analyst run.
- Scheduled and pre-market runs, with orders approved before the open queued for it.
- Performance against a benchmark, tracked daily on the scale of the budget, and an API-cost page that shows spend as a percentage of trading capital.
- Phone notifications when proposals are waiting, an exit fires, or the worker reports an error.

How I worked — from boilerplate to AI
I set the requirements and made the design calls: approval on every buy, a fixed budget, short-term trading in the sectors I follow, Alpaca for control, exits carried out automatically, and a private always-on server rather than a public one. I wrote the risk profile and rules the agent is held to. Most of the code was written with an AI coding assistant working from those decisions, and I reviewed the final code, iterated, and cross-checked behavior through live tests (real money) and paper trading.
The judgment that matters here is where the model is allowed to act. It reads and proposes. It never holds an object that can place an order.
Problems worth naming
The API keys can't be scoped. Alpaca keys don't come in read-only form, so "the agent can't trade" couldn't rest on the key. It rests on the code: the analyst only ever receives a wrapper with no order methods.
A stop that could sell twice. The exit monitor read positions before checking whether the broker stop had already filled, so in a fast drop it would see shares that were already gone and send a second sell. A test caught it; the monitor now checks orders first.
Morning runs that never happened. Scheduled runs were gated on the market being open, so every pre-market time I scheduled was skipped without a trace. Runs from 07:00 to the open are now allowed, and anything skipped is written to the activity log.
Answers cut off mid-sentence. The chat had a 1,024-token ceiling, which longer answers ran into. The limit went up, and a reply that still hits it now says so.
Relevance the model invents. A scorer asked whether an article matters will happily say yes. A score now only counts if it names a ticker or sector that's actually in the portfolio, watchlist or targets; otherwise the code sets it to zero.

Results
It runs around the clock on a small cloud server and trades a $300 paper account. I'm not publishing performance numbers: a few weeks of paper trading can't separate skill from noise, and the honest measure so far is whether the proposals match how I'd trade and whether the exits fire when they should. So far it has performed within expectations, if not exceeded them. The test suite has 57 tests, including the agent loop against a scripted model and the dashboard pages driven headlessly.
One number I watch closely: an analyst run costs about three cents, which matters when the account is small enough that API spend can outweigh returns.
What I learned
The model was the easy part. The work was in the boundaries around it: what it may see, what it may do, and what happens when a scheduled job, a broker rule, or a network quietly doesn't behave the way the code assumed.
Next
- Run on paper long enough to judge it, then go live with a small funded account
- Options, limited to buying calls and puts with their own dollar cap
- A playbook distilled from the books I've read, written as rules the agent is held to