Autonomous Agent Trader
MCP · OAuth2 · 53 testsA research and engineering build exploring how to let an agent trade safely. The core design decision: the LLM is allowed to think only at setup, and deterministic code owns execution and every guardrail. This is a study in agentic architecture, not a money machine, and it has never traded live.
The Question
How do you let an agent act without letting it improvise?
An LLM in the order path is a liability: non-deterministic, hard to test, and capable of expensive surprises. But an LLM is genuinely useful for reading context and forming a plan. The design problem is drawing a hard line between the two.
The Architecture
LLM at setup. Deterministic code at execution.
The model reads news and builds a plan once. From there, a deterministic state machine owns every per-tick decision: entry, exit, scaling, and all guardrails. No model call ever touches the order path, which makes the whole system testable and predictable.
What I built.
Deterministic execution engine
A tested state machine for entries, auto-exits, and scaling, with conviction-scaled sizing, a hard kill-switch, a three-strike rule, and no averaging down.
Live plumbing, gated
An OAuth2 refresh session and an MCP transport seam. Order payloads are gated behind explicit live-and-armed checks and send nothing in dry-run.
Signal and convergence layer
A data layer that scores market signals and gates on convergence between trend and flow before a setup is even considered.
Measurement harness
A shadow harness that measures the strategy against a baseline so any edge has to be demonstrated, not assumed.
Tech stack.
Core
- Python
- Deterministic state machine
- Pure stdlib, runs offline
Integration
- MCP transport
- OAuth2 refresh flow
- Broker API payloads (gated)
Discipline
- 53 passing tests
- Dry-run by default
- Shadow measurement harness
Honest posture.
This is paper-stage and has never traded real money. My own prior research found no durable edge in the underlying strategy, and most active traders lose. The value of this project is the engineering: a clean separation between probabilistic reasoning and deterministic execution, real broker-auth plumbing, and a test suite that keeps the risky parts honest. I would rather show a guardrailed system that is not live than overstate one that is.