Skip to content

a2sh16/ahmad-options-engine

Repository files navigation

Autonomous Options Trading Engine

A fully autonomous, multi-strategy options trading bot — built in Python, integrated with Alpaca paper trading API, and designed for zero-touch daily operation.

Python Alpaca API License Status Halal

Notice: This repository is a showcase portfolio. The source code, proprietary algorithms, and trading logic are strictly private and not open source.


What It Does

The engine wakes up every trading day at 8:25 AM ET, scans the market using five independent strategies, selects the highest-scoring setups, places limit orders at 9:31 AM, monitors positions every 5 minutes throughout the day, and exits via target, stop-loss, or time-based rules — all without any human input.


Screenshots

Morning Scan Log — Autonomous Strategy Evaluation

The bot evaluates all five strategies in sequence, scores each setup, and logs every decision in real time.

Morning Scan Log


Trade Log — Automated Entry & Exit Record

Every trade is recorded with full context: strategy label, contract details, entry/exit prices, P&L, and exit reason.

Trade Log


Strategy Performance Dashboard

Win rates, average returns per trade, and P&L contribution breakdown across all five strategies.

Strategy Dashboard


System Architecture

End-to-end data flow from market data ingestion through strategy evaluation, risk management, order execution, and persistent logging.

System Architecture


The Five Strategies

Label Strategy Signal Source Typical Hold
A Earnings IV Expansion Pre-earnings implied volatility surge 1–5 days
B Post-Earnings Mean Reversion Overreaction fade after earnings miss/beat 2–7 days
C Analyst Upgrade Momentum Institutional upgrade with price target raise 3–10 days
D 52-Week High Breakout Price clearing prior resistance with volume 3–10 days
E Sector ETF Rotation Sector momentum shift via ETF relative strength 5–15 days

Risk Controls

  • Max 3 open positions at any time
  • Max $2,500 per position, max $7,000 total exposure
  • Stop-loss on every position — no naked risk
  • Never hold through earnings (unless the trade is an earnings play)
  • Islamic / Sharia compliance — hard-coded exclusion list blocks banks, insurance, alcohol, tobacco, weapons, gambling, and payment networks

System Architecture Overview

External APIs          Core Engine              Storage
─────────────          ───────────              ───────
Alpaca Market Data  →  Daily Scheduler      →   Activity Logs
Earnings Calendar   →  Strategy Engine (A-E) →  Trade History
Alpaca Trading API  →  Risk Manager         →   State / Positions
                    →  Trade Executor
                    →  Position Monitor (5-min)

Daily Schedule

Time (ET) Action
8:25 AM Bot wakes up, loads state, validates API connectivity
9:31 AM Morning scan — all 5 strategies evaluated, top setups entered
Every 5 min Position monitor — checks P&L, stop-loss, target levels
3:45 PM Final intraday check — close any positions near expiry
4:15 PM Bot shuts down, writes daily summary to log

Tech Stack

Layer Technology
Language Python 3.11
Broker API Alpaca Markets (paper + live)
Data Alpaca Market Data v2, earnings calendar scrapers
Scheduling Custom Python scheduler with crash recovery
Storage CSV trade log, JSON position state, rotating log files
Deployment Linux cron + systemd-compatible background process

Repository Structure

showcase_portfolio/
├── README.md               ← This file
├── ARCHITECTURE.md         ← Detailed system design
├── PRODUCT_BRIEF.md        ← Executive summary
├── TECH_STACK.md           ← Full technology breakdown
├── METRICS.md              ← Performance benchmarks
├── DEMO_GUIDE.md           ← How to run a demo
├── PRIOR_ART.md            ← Timestamped IP record
├── LICENSE                 ← Proprietary license
├── index.html              ← GitHub Pages landing page
└── SCREENSHOTS/
    ├── 01_morning_scan_log.png
    ├── 02_trade_log.png
    ├── 03_strategy_dashboard.png
    └── 04_architecture.png

Note: The core trading engine (bot.py, .env, API keys, live trade logs, and position state) are intentionally excluded from this repository. This showcase contains architecture documentation and sanitized visual outputs only.


Intellectual Property

This system was designed, architected, and built by Ahmad in 2026. All strategies, risk logic, scheduling architecture, and Islamic compliance filtering are original work. See PRIOR_ART.md for the timestamped IP record.


Disclaimer

This project is for educational and research purposes only. Paper trading results do not guarantee live trading performance. Options trading involves substantial risk of loss. Nothing in this repository constitutes financial advice.


Built with Python · Powered by Alpaca · Timestamped May 12, 2026 © 2026 Ahmad. All Rights Reserved.

About

Autonomous multi-strategy options trading engine — Python, Alpaca paper trading, zero-touch daily operation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages