An open-source, multi-asset, multi-broker quantitative trading ecosystem. Unites real-time market scanners, multi-agent LLM consensus research (LangGraph), institutional deterministic risk validation, and automated execution across US Equities, Options, Futures, Crypto, and Forex.
┌────────────────────────────────────────────────────────────────────────────────┐
│ 🌐 OpenTradeAI Terminal — Live Quantitative Execution Engine │
│ Status: ACTIVE | Engine: LangGraph AI | Risk Gate: DETERMINISTIC HARD LIMITS │
├────────────────────────────────────────────────────────────────────────────────┤
│ 🔍 Scanner: 5 High-RVOL Setups Identified (NVDA, TSLA, AAPL, SPY, SOL) │
│ 🤖 Multi-Agent Consensus: BULLISH (Confidence: 81.4% | Regime: TREND_EXPAND) │
│ 🛡️ Risk Engine Gate: APPROVED (Drawdown: 0.0% | Max Size: $10,000 | Kill: OFF)│
│ ⚡ Broker Status: Paper Simulation Active ($100,000 Starting Cash) │
└────────────────────────────────────────────────────────────────────────────────┘
I engineer high-performance trading software, broker API integrations, and machine learning models for hedge funds, prop traders, and private syndicates.
- 💬 Telegram: @JanzebBlockdev
- 💼 Fiverr Profile: Verified Quantitative Developer (Fiverr)
- Key Architectural Highlights
- End-to-End System Pipeline
- Multi-Agent Consensus Matrix
- Deterministic Risk Gate (Anti-Hallucination)
- REST API & WebSocket Documentation
- Supported Markets & Broker Connectors
- Installation & Quickstart
- CLI Terminal Walkthrough
- Explore Connected Quantitative Projects
- Disclaimer
- Multi-Agent Research Engine: Deploys specialized agents (Technical Analyst, Bullish Catalyst, Bearish Risk, Sentiment NLP) engaging in structured debates to reach calibrated confidence scores (0–100%).
- Deterministic Risk Gate: AI agents generate proposals, but no trade executes without deterministic risk verification. Pre-trade checks enforce hard portfolio drawdown limits, daily loss ceilings, and buying power constraints.
-
Universal Multi-Asset Scanner: Evaluates thousands of instruments for Relative Volume surges (
$\ge 1.5\times$ ), VWAP standard deviation bands, and momentum breakout triggers. - Zero-Latency Paper Broker: Built-in paper trading engine with simulated slippage, commissions, and automated position ledger updates for strategy validation out-of-the-box.
- Production-Grade Microservice Backend: FastAPI REST server with asynchronous endpoints, full OpenAPI/Swagger documentation, and Docker Compose orchestration.
flowchart TD
subgraph Market Data Layer
MD1["Polygon.io / Databento"] --> DP["Data Normalization Pipeline"]
MD2["Interactive Brokers TWS / Gateway"] --> DP
MD3["Crypto Exchanges (CCXT / Binance)"] --> DP
end
subgraph Intelligence & Quant Core
DP --> MS["Universal Market Scanner (RVOL >= 1.5x, VWAP Dev)"]
MS --> AI["Multi-Agent AI Panel (LangGraph Consensus)"]
AI --> SYN["Synthesized Thesis & Calibrated Confidence Score"]
end
subgraph Deterministic Risk Barrier
SYN --> PROP["Structured Trade Proposal (Ticker, Action, Qty)"]
PROP --> RE["Deterministic Risk Engine (Hard Pre-Trade Rules)"]
RE -->|Drawdown or Loss Breach| REJ["[REJECT ORDER] Logged to Audit Trail"]
RE -->|Approved & Size Capped| EX["Order Manager & Smart Router"]
end
subgraph Broker Execution
EX --> B1["Paper Simulation Broker"]
EX --> B2["Interactive Brokers (Port 7497/7496)"]
EX --> B3["MetaTrader 5 (MT5 Bridge)"]
end
Each agent operates autonomously with distinct domain objectives to eliminate confirmation bias:
| Agent | Focus Area | Inputs / Models | Weight | Stance Criteria |
|---|---|---|---|---|
| Technical Analyst | Momentum, Overbought/Sold | RSI, VWAP, EMA Stacks, ATR | 35% | Bullish if price > VWAP & RSI |
| Bullish Catalyst | Upside Breakouts, RVOL | Relative Volume, Order Flow Depth | 25% | Bullish if RVOL |
| Bearish Skeptic | Downside Traps, Resistance | Liquidity Pools, Overhead Supply | 20% | Neutral/Bearish if daily extension |
| Sentiment NLP | News Flow, Narrative Velocity | Social Polarities, Financial Filings | 20% | Bullish if Polarity |
AI models are probabilistic; risk management must be strictly deterministic. The risk engine vetoes any order that violates preset parameters:
| Risk Parameter | Enforcement Limit | Action on Breach |
|---|---|---|
| Emergency Kill Switch | Global Binary Toggle | Immediate rejection of all outbound orders |
| Max Portfolio Drawdown | 5.0% from Peak Equity | Halts new positions until drawdown recovers |
| Max Daily Loss | $1,000.00 USD Realized | Disables trading for the remainder of the session |
| Single Trade Allocation | 2.0% Account Risk | Clamps quantity down to maximum approved dollar size |
| Max Open Positions | 5 Concurrent Holdings | Rejects entries for new symbols |
| Buying Power Guard |
|
Rejects orders exceeding live purchasing capacity |
When launched with python main.py --mode server, FastAPI serves interactive Swagger docs at http://localhost:8000/docs:
GET /health— Service health and emergency kill-switch status.GET /api/v1/account— Real-time net liquidation, buying power, and daily realized PnL.GET /api/v1/positions— Active open portfolio positions with average entry prices.GET /api/v1/scan?min_rvol=1.5&min_change=0.5— Scans universe for momentum candidates.GET /api/v1/market-data/{symbol}— Retrieves latest quotes and VWAP values.POST /api/v1/agents/research?symbol=NVDA— Dispatches multi-agent panel and returns consensus report.POST /api/v1/orders/preview— Simulates order through Risk Engine without execution.POST /api/v1/orders/execute— Submits order for execution strictly subject to risk validation.POST /api/v1/risk/kill-switch— Engages or disengages global emergency kill switch.
curl -X POST "http://localhost:8000/api/v1/agents/research?symbol=NVDA"| Asset Class | Primary Broker / Feed | Key Capabilities |
|---|---|---|
| US Equities & ETFs | Interactive Brokers (TWS / Gateway) | Gap scanners, VWAP breakouts, limit/stop orders |
| Options & 0DTE | IBKR API & Cboe Feeds | Greeks (Delta, Gamma, Vega), IV skew, SPX 0DTE |
| Futures | CME via IBKR / Tradovate | ES, NQ, CL, GC front-month rollovers, VWAP |
| Crypto & Meme Coins | Binance, Bybit, Solana WebSockets | Raydium/Pump.fun tracking, smart money wallets |
| Forex | MetaTrader 5 (MT5 Bridge) | Institutional prop firm risk limits, session breakouts |
# 1. Clone repository
git clone https://github.com/jahanzaib-codes/OpenTradeAI.git
cd OpenTradeAI
# 2. Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Copy environment configuration
cp .env.example .env
# 5. Run automated end-to-end demo pipeline
python main.py --mode demodocker-compose up --buildLaunch the interactive command-line trading suite:
python main.py --mode cli[MAIN MENU]
1. 🔍 Run Universal Market Scanner
2. 🤖 Run Multi-Agent AI Research on Ticker
3. 🛡️ Simulate Deterministic Risk Engine Check
4. ⚡ Execute Paper Trade Order
5. 📊 View Portfolio Positions & Account Summary
6. 🚨 Toggle Emergency Kill Switch
7. ❌ Exit Terminal
- 🎯 IBKR Options Intelligence & 0DTE Suite — Institutional SPX 0DTE analytics, GEX profiling, and multi-leg spread execution.
- 📈 IBKR AI Options Trading Bot & GUI — Desktop options terminal with trained XGBoost classifier and backtesting suite.
- ⚡ Solana Pump.fun 0-Block Sniper Bot — Ultra low-latency meme coin sniper powered by Rust and Jito MEV bundles.
- 🛡️ PropFirm MT5 Risk Guardian EA — Institutional MQL5 risk manager enforcing daily and total drawdown limits for FTMO / FundedNext.
- 🔮 Polymarket Prediction Arbitrage Bot — Real-time binary market arbitrage engine exploiting price discrepancies across predictive books.
OpenTradeAI is an open-source software platform designed for quantitative research, algorithmic strategy development, and educational purposes. Trading financial markets involves substantial risk of capital loss. Always validate strategies extensively in paper trading mode before committing live capital.
Maintained by Jahanzaib (@jahanzaib-codes)