Skip to content

KunalJha1/TWS-API-Trading-Programs

Repository files navigation

📊 IBKR Trading Bot & Multi-Timeframe Trading Dashboard

A streamlined set of Python based trading systems which combine:

  • Real-time Technical Analysis GUI which includes a multi-timeframe indicator interface with parallel processing & caching
  • Automated NQ futures trading
  • Automated options volume & unusual activity scanner with daily reports
  • Historical backtesting engine for futures and equities strategies

🚀 Features

🔹 Technical Analysis GUI (CustomTkinter)

Full source code: Technical Analysis GUI

GUI Project

GUI Project Indicators

  • Multi-timeframe indicator engine: • 1m / 3m / 5m / 15m / 30m / 1h / 4h / 1d • GUI Built using CustomTkinter
  • 20+ indicators including: • EMA (6/21, 9/14), MACD Histogram, ATR
    • RSI, Momentum, Stoch, Williams %R
    • ADX + DI+/DI-, OBV, Volume Spike
    • Heikin Ashi, Parabolic SAR, Pivot Points
  • Summary per timeframe: • BUY / SELL / NEUTRAL counts
    • Weighted Overall signal
  • Watchlist with: • Live pricing using the TWS API
  • Additional features: • Built-in caching
    • Async historical data fetching
    • CPU/RAM usage metrics

🔹 NQ Futures Scalping Bot

Full source code: Live Scalping Strategy

Open Position

Dynamic Trailing Stop Loss and Profit Taker

  • Connects to IBKR TWS API
  • Uses 2 years of data for calculations
  • Executes automated long and short trades when conditions align
  • Adaptive order entry using IBKR Adaptive Algo
  • Dynamic trailing stop-loss + profit-taker attached to all executed trades
  • Email alerting system for, entries, exits (profit-taker / stop-loss), disconnect/reconnect events.
  • Logs every trade to CSV (entry/exit, gain %, timestamps)

🔹 Options Volume & Unusual Activity Scanner

Full source code: Options Scanner

Option Volume Read Me

  • Scans stocks, ETFs, and futures options (NQ/ES/GC) using the IBKR API
  • Automatic Scheduler to run the program at 12:30 PM MT every day
  • Filters for high-volume and unusual-volume contracts
  • Extracts greeks: Δ / Γ / Θ / Vega / IV
  • Generates 4 CSV reports: full dataset, Top 10 volume, Unusual volume, PCR
  • Parallel processing for fast daily scans of option volume.
  • Sends a detailed email summary + attachments after every run of the program to clients.

🔹 Historical Backtesting Engine (NQ, ES, GC + Equities)

Full source code: Backtesting System (IBKR TWS Historical)

NQ Backtesting Results – Feb to Apr

  • Uses IBKR historical data for CME futures (NQ, ES, GC) and equities/ETFs
  • Runs a rule-based strategy simulator with trend-start, in-trend, and close-position logic
  • Simulates profit-target (≈1%) and stop-loss behavior with trailing logic for long/short trades
  • Starts from a fixed capital base (e.g., $7,000) and computes compounded returns over the test window
  • Supports combinatorial testing of indicator weight configurations, evaluating thousands of combos per run
  • Parallelized using Python multiprocessing to speed up multi-combo backtests
  • Exports CSV summaries for:
    • All tested configurations
    • Best-performing combo (with full trade log)
    • Worst-performing combo (for risk analysis)

If you have anything you would like to talk about regarding this project please email me at kunal.jha@uwaterloo.ca. Please note all code inside of this repo will be incomplete as sections are redacted to keep trading strategies secure.

Disclaimer

This project is for educational and research purposes only. Futures, equities, and leveraged ETFs involve significant risk and may not be suitable for all investors. Nothing in this repository constitutes financial advice. Always test thoroughly using paper trading before deploying with real capital, and trade at your own risk.

About

Python trading systems built on the Interactive Brokers (IBKR) TWS API, including a multi-timeframe technical analysis GUI, automated NQ futures bot, options volume scanner, and backtesting engine. Code is partially redacted to protect trading strategies.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages