How lowquant/ib-multi-strategy-ats works
Project Type and Purpose
• Type: Full-stack desktop application (Automated Trading System) with GUI, core trading logic, data/research modules, and integration with external services.
• Purpose: Manage and execute multiple trading strategies via Interactive Brokers (using ib_async), store and query data in ArcticDB, provide a user-friendly GUI for configuration, monitoring, and research.
File Structure Analysis
• Top-level modules:
• gui/ – Presentation layer (settings, portfolio, database, research windows)
• strategy_manager/ – Strategy loading, management, and execution
• broker/ – Trading integration, connection, order/risk/portfolio management
• data_and_research/ – Data ingestion, storage (ArcticDB), scheduled jobs, Jupyter notebooks
• main.py – Entry point that initializes GUI and core services
• Supporting files:
• options.xlsx, univ_us_equities.csv – static reference data
• setup.py & .egg-info – installation/configuration
• README.md – project overview, architecture notes, usage
Key README Insights
• Architecture calls out:
• StrategyManager handles dynamic strategy loading & execution.
• PortfolioManager interfaces with IB and ArcticDB for live P&L & positions.
• GUI modules orchestrate user interactions with core services and data.
• External services: IB Gateway/TWS via ib_async, ArcticDB for persistence, cron for scheduled jobs.
Main Components
a. Frontend (GUI)
• Settings Window
• Portfolio Window
• Database Explorer
• Research Tools
• Start Trading Dashboard
b. Core Application Services
• StrategyManager
• PortfolioManager
• TradeManager & RiskManager (inside broker/)
• DataManager (ArcticDB interface)
c. External Services & Data Stores
• Interactive Brokers API (via ib_async)
• ArcticDB (local or remote storage)
• File-based data (CSV/XLSX)
• Cron scheduler for data jobs
d. Research & Batch Jobs
• Jupyter Notebooks for ad-hoc analysis
• Python scripts under data_and_research/jobs/
Relationships and Interactions
• GUI → Core Services
• User actions in GUI invoke StrategyManager, PortfolioManager, DataManager.
• StrategyManager ↔ Broker
• Loads strategy code → generates orders → sends to TradeManager.
• Broker ↔ Interactive Brokers
• TradeManager submits orders, receives fills; PortfolioManager fetches positions and account data.
• Core Services ↔ ArcticDB
• Persist P&L, cash flows, positions, historical data via DataManager.
• GUI Database Explorer queries DataManager.
• DataAndResearch ↔ ArcticDB
• Scheduled jobs pull market data, store in ArcticDB.
• Research notebooks query ArcticDB for backtesting or analysis.
Architectural Patterns & Principles
• Modular Layering: Clear separation between Presentation (GUI), Business Logic (StrategyManager, PortfolioManager), Data Access (DataManager/ArcticDB), and External Integrations (IB API).
• Plugin Strategy Pattern: Dynamic loading of strategy modules under strategy_manager/strategies/.
• Event-driven / Async I/O: ib_async allows non-blocking market data & order flow.
• Batch vs Interactive Modes: GUI-driven live trading vs scheduled data jobs.