## Session Closeout: Autonomous Trading Agent (2026-04-17)
### What Was Built
A fully autonomous swing trading agent at `~/repos/trading-agent/` that manages an Alpaca paper trading account ($100k). The system operates on a cron schedule during market hours, consumes differentiated data sources, and makes trading decisions through Claude CLI.
### Architecture
“`
SEC EDGAR → ┐
FRED API → ┤
Alpaca News →├→ collector (PM2) → SQLite → run.sh (cron) → Claude CLI
EIA Petroleum→┤ ↓
Market Data → ┘ TRADE_SIGNAL blocks
↓
executor.py → risk.py → Alpaca API
↓
Discord #trading
“`
### Trading Strategies
| Strategy | Allocation | Edge |
|———-|———–|——|
| News Reactive | 40% | Speed — act on breaking news before market prices it |
| Alt Data Deep Dive | 35% | Information — EIA petroleum, vessel tracking, trends |
| Insider Following | 15% | Form 4 insider buys >$100k, cluster buys |
| Macro Rotation | 10% | FRED yield curve, employment, CPI → sector ETFs |
### Risk Engine (All Deterministic Python)
– Max 25% per position, 5 position cap
– -3% daily circuit breaker halts all trading
– 10% cash reserve, 8% trailing stops
– No shorts, margin, options, or leveraged ETFs
– Claude proposes trades; code enforces limits
### First Trading Run Results
Claude analyzed SEC filings (14 insider trades), FRED data (unemployment 4.3%, yield curve +0.55%, WTI $100.72, VIX 17.94), and 8 news articles. Three trades queued for Monday:
1. **LCII** (50 shares) — Merger arb: Patrick Industries confirmed acquisition discussions
2. **XLE** (100 shares) — Macro rotation: steepening yield curve + $100 oil supports energy
3. **META** (5 shares) — Layoff margin play: 10% workforce cut announced for May 20
Total deployment: ~$12,940 (13% of portfolio)
### Technical Details
– **5 commits**, 3,473 lines across 24 files
– PM2 `trading-collector` service: polls 6 data sources on schedule
– Cron: `*/30 13-19 * * 1-5` (every 30min during market hours)
– Per-strategy virtual sub-accounts for independent P&L tracking
– Research agent can spawn Claude deep-dives on high-signal tickers
– Discord #trading channel with trade notifications + daily/weekly reports
### Data Flow Verified
– SEC EDGAR: 14 Form 4 insider trades (AAPL, META, AMZN, MSFT, JPM)
– FRED: 10 indicators including VIX, oil, yield curve, HY spreads
– Alpaca News: 15 articles, 5 triggered (including Strait of Hormuz headline)
– Market Data: Live prices for all 27 watchlist tickers