
SPY Weekly Iron Butterfly turns a historically tested options strategy into an autonomous trading agent built on Alpaca. Rather than relying on a fixed entry time, the agent monitors SPY minute-by-minute during the Monday entry window and evaluates the trailing 20-minute price range. When market conditions stabilize according to its decision rules, it selects an ATM strike and constructs a defined-risk four-leg Iron Butterfly with 10-point wings. From there, the agent manages the full trade lifecycle autonomously. It executes through Alpaca, continuously monitors SPY and the open position, and exits when predefined wing-breach, profit/loss, or time-based conditions are triggered. A mandatory Thursday exit prevents positions from remaining open into expiration. Market observations, decisions, orders, fills, and position events are logged to provide a transparent audit trail of the agent's behavior. The strategy was backtested from Aug. 2021–Aug. 2026 across 97 trades, producing a 59.8% win rate, +$108,840 cumulative backtested P&L, 1.06 Sharpe ratio, and -$36,280 maximum drawdown. Historical results are not indicative of future performance. The repository contains the complete Python agent and strategy implementation, Alpaca market-data and trading integration, backtest framework, historical SPY data, audit logging, technical documentation, presentation, and interactive demonstration. Tech: Python 3 · Alpaca Trading API · Alpaca CLI · Pandas · NumPy
4 Sep 2026