This repository provides production-ready trading frameworks for Interactive Brokers (IBKR). Each setup is designed for live execution with automated data management, configurable strategies, and robust error handling.
- Author: José Carlos Gonzáles Tanaka
- QuantInsti's EPAT Content Team is responsible for maintaining and contributing to this repository.
The repository includes three specialized trading setups:
- Multi-Asset Trading (
ibkr-multi-asset/): A strategy-, trading-frequency-, asset-, and exchange/venue-agnostic framework for FX, futures, spot metals, crypto, stocks, equity options, and futures options. It does not require one venue: exchange, currency, routing, and primary-exchange settings remain configurable. Selected symbols must be valid on their chosen IBKR-supported exchange and have correct contract details, currency, routing, and market-hours metadata. The bundled configuration is an example, not a framework limit. Seeibkr-multi-asset/README.mdfor details. - Forex Trading (
ibkr-forex/): A dedicated framework for FX execution. It is not exchange-agnostic within IBKR: cash Forex contracts are limited toIDEALPRO, and other venue settings are not interchangeable. - Stock Trading (
ibkr-stock/): A modular, exchange/venue-agnostic framework for systematic equity trading. It does not require one venue: exchange, currency, routing, and primary-exchange settings remain configurable, and selected symbols must be valid on their chosen IBKR-supported exchange and have correct contract details, currency, routing, and market-hours metadata.
- Unified Execution Engines: Production-grade frameworks supporting concurrent execution across multiple asset classes or focused single-asset strategies.
- Strategy-Agnostic Architecture: Decoupled core engines from strategy logic. A strategy that implements the required interface can be dropped into
user_config/and plugged in without touching the underlying framework. This repository is yours once you clone it: if your strategy needs more than the interface supports, change the engine source however you need to, subject only to the license (see LICENSE.md). - Automated Data Infrastructure: Integrated utilities for bulk historical data acquisition and local data management across all setups.
- Performance Analytics & Reporting: Automated generation of performance metrics and reports for portfolio monitoring.
- Robust Error Recovery: Self-healing configuration with default parameter fallbacks and connection monitoring to ensure operational continuity.
The project is organized to separate the core trading engine from user-specific configurations and strategies.
src/ibkr_multi_asset/: Core engine, portfolio rebalancing, and PDF reporting logic.user_config/: Primary entry point (main.py) and strategy implementation.llm-guide.md: Paste this file into any LLM (Claude, GPT-4, DeepSeek) to generate a custom trading strategy without writing code: provide your backtest script or describe your strategy in plain language.
src/ibkr_forex/: Core engine optimized for FX-specific order types and data handling.user_config/: Connection settings and Forex strategy logic.
src/ibkr_stock/: Core engine featuring contract detail utilities and equity data management.user_config/: Portfolio settings and equity strategy logic.
- Clone the repository:
git clone https://github.com/QuantInsti/QuantInsti-Live-Algo-Trading-Setups
- Select a setup directory:
Navigate to
ibkr-multi-asset/,ibkr-forex/, oribkr-stock/depending on your trading requirements. - Review the documentation:
Each setup includes a
doc/folder with detailed setup and strategy development guides. - Configure environment: Set your credentials in
user_config/main.pyor via environment variables (seeuser_config/.env.examplefor the required variable names). - Execution: The engine uses relative paths for its own data/log files, so it must be launched from inside
user_config/, not from the setup's root:cd ibkr-multi-asset/user_config python main.py
Trading involves substantial risk, and this project is for educational purposes only. The authors or contributors are not responsible for any financial losses. You should always test your strategies thoroughly in a paper trading account before deploying with real capital.