An autonomous options-trading agent where Claude is the decision-maker.
A scheduler wakes Claude on a cron schedule through the trading day. Each session Claude reads market data, computes its own signal, reasons through risk and signal gates, places call-option orders through Alpaca, manages positions, and reflects on performance — with no human in the loop. The only hard human control is a single environment flag that gates live trading.
Status: paper-validation. The system trades paper only and does not scale or enable live capital until ≥ 20 closed trades show positive measured expectancy.
Current architecture baseline: On 2026-06-10, commit
d05363drebuilt APEX-1 around an owned GEX + momentum signal and removed Unusual Whales and yfinance from the active system.
APEX-1 is built on three ideas:
- Claude is the brain, not a notifier. A thin Python loop (
agent.py) hands Claude a session prompt and a toolbox, then executes the tool calls Claude makes until it decides the session is done. - The signal is fully owned. No external signal vendors. APEX-1 computes a dealer-gamma (GEX) map plus momentum entirely from Alpaca data.
- Survival first. Hard risk limits (position size, count, drawdown, calls-only, DTE, forced flat by 3:45pm) are enforced in code — the model cannot override them.
Scheduler (scheduler.py) → wakes → Agent Loop (agent.py) → calls → Tools (tools/)
↕
Anthropic Messages API
(Sonnet for reasoning, Haiku for monitoring)
Sessions (ET, Mon–Fri): signal generation 8:15 · premarket 8:30 · trading 9:45 & 14:00 · monitor every 5 min · force-close 15:45 · postmarket 16:30 · evolution 17:00.
A slow structural map and a fast trigger.
- Structural (leading) —
tools/gex.py. Pulls calls + puts with open interest from Alpaca, computes gamma locally (Black-Scholes), and aggregates to net GEX, the zero-gamma flip, and the call/put walls. Positive net GEX = dealers suppress volatility (price pins / mean-reverts); negative = dealers amplify it (price trends / breaks out). - Trigger (confirming) —
tools/market.py. Opening-range breakout, volume ratio, and 5m/1h momentum confirm the entry. Momentum never enters alone. - Setups (
tools/signal.py, calls only):negative_gamma_breakout(net GEX < 0, spot above the flip, momentum up) andpositive_gamma_drift(net GEX > 0, spot below the call wall with room, momentum up). - Universe: liquid index ETFs (SPY, QQQ, IWM) — deep gamma, tight spreads, no earnings risk.
Enforced in the tool layer (tools/alpaca.py), not just in prompts:
- Forced paper mode unless
LIVE_TRADING_ENABLED=true. - Max premium $40 live / $160 paper, calls only, DTE ≥ 3, max 3 open positions, 8% daily drawdown halt.
- Force-close at 3:45pm ET — no overnight holds.
- Compounding-aware sizing (
suggest_position_size) risks 1% of equity per trade, always clamped under the hard premium ceiling. - A two-tier review "council": inline Signal/Risk gates (zero API cost) plus independent Trade-Reviewer and Evolution-Validator Claude calls whose BLOCK verdicts are binding.
| Service | Role | Notes |
|---|---|---|
| Anthropic API | Reasoning brain | Sonnet (reasoning) / Haiku (monitoring) |
| Alpaca | Broker + all market data | Execution, stock bars, option contracts/OI, real-time OPRA quotes (Algo Trader Plus) |
| Telegram | Audit notifications | Not an approval gate |
No Unusual Whales, no yfinance. Those external vendors were removed from the
active system on 2026-06-10 in commit d05363d (Rebuild on owned GEX + momentum signal; remove external vendors). VIX is not offered by Alpaca, so the
volatility regime gauge is SPY ~30-day ATM implied vol computed locally (see
docs/CHANGELOG.md).
agent.py Agentic loop (Anthropic Messages API)
scheduler.py APScheduler cron triggers (ET)
config.py Constants: safety limits, sizing, universe, regime thresholds
tools/
gex.py Dealer-gamma map
signal.py GEX + momentum signal engine
market.py Regime, momentum, earnings (Alpaca)
alpaca.py Execution, chains, real-time quotes, sizing
blackscholes.py Shared delta/gamma/IV math
memory.py State files (file-locked)
trades_db.py Trade journal queries
telegram.py Audit messaging
council/ Two-tier review governance
prompts/ System + per-session prompt templates
db/schema.py SQLite schema
tests/ pytest suite
docs/
CHANGELOG.md Change history
plans/ Design/rearchitecture plans
archive/ Superseded specs + historical audit
CLAUDE.md Developer/agent guide
pip install -r requirements.txtCreate a .env in the project root (never commit it — it is gitignored):
ANTHROPIC_API_KEY=...
ALPACA_API_KEY=...
ALPACA_SECRET_KEY=...
ALPACA_BASE_URL=https://paper-api.alpaca.markets
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...
LIVE_TRADING_ENABLED=false
python db/schema.py # initialize the database
python agent.py --session trading --dry-run # mocks execution, real data
python scheduler.py # run all sessions on cron
python -m pytest tests/ -v # test suite
python -c "from tools.gex import compute_gex; print(compute_gex('SPY'))"docs/CHANGELOG.md— change historydocs/plans/— design and rearchitecture plansCLAUDE.md— developer/agent guide
APEX-1 trades real financial instruments and can lose money. It is a research system provided as-is, with no warranty. Nothing here is financial advice. Run it on paper and validate a positive edge before risking live capital.