
This project is an autonomous options trading agent built for Alpaca's paper trading environment, with every trading operation routed through Alpaca's official MCP server rather than direct API calls. The agent fetches the live option chain for a target ticker, filters contracts by delta (0.15 to 0.30) and premium to select a cash secured put, then pulls recent news for the underlying and passes it to an LLM (Groq, running openai/gpt-oss-20b) to score market sentiment. This sentiment signal is logged alongside every trade decision as an audit trail and a foundation for future confidence weighted gating, though it does not currently block execution. Before any order is placed, the selected contract passes through three deterministic risk gates: capital sufficiency, position sizing (capped at 10 percent of portfolio value per trade), and duplicate exposure, which checks both filled positions and open unfilled orders on the underlying. This last check was added after testing revealed a real gap: an unfilled limit order does not appear in position data, so a naive positions-only check would allow duplicate orders to stack before either filled. Every decision, executed or rejected, is logged as structured JSON with the full context: contract, delta, bid, capital required, account state, gate outcome, and reasoning. The agent has been tested end to end on a dedicated paper account seeded at 100,000 dollars, with real orders placed and real rejections captured on both gate paths.
4 Sep 2026