This project was originally built from scratch as a research and educational exploration of AI-driven trading systems.
Through experimentation, it became clear that fully relying on large-scale AI models for real-time trading introduces significant latency and cost challenges, making the system not cost-effective for live production deployment at this stage.
Instead of pushing this system directly into production, the development strategy has shifted toward building lightweight, cost-efficient trading tools https://github.com/Yusuprozimemet/trading-tools β with AI being integrated gradually and only where it provides real benefit.
This ensures maintainability, performance, and predictable operating cost as the system evolves.
A comprehensive AI-powered trading system built with Microsoft Agent Framework, LangGraph orchestration, and RAG-enhanced decision making. Features microservices architecture with multi-agent trading intelligence.
# Option A: Complete system (production)
pip install -r requirements.txt
# Option B: Minimal setup (local development)
pip install -r requirements/requirements-minimal.txt
# Option C: Specific phase development
pip install -r requirements/requirements-phase2.txt # Smart Trading
pip install -r requirements/requirements-phase3.txt # Enhanced Orchestration# Copy environment template
cp .env.example .env
# Option A: Ultra low-cost deployment (Recommended for learning)
docker-compose -f docker-compose.lite.yml up -d
# Option B: Start core service only (no infrastructure)
cd services/vector_service && python main.py
# Test the system
curl http://localhost:8000/health# Nano: Ultra low-cost ($5-15/month)
docker-compose -f docker-compose.lite.yml up -d
# Micro: Low cost with cloud DB ($25-50/month)
docker-compose -f docker-compose.micro.yml up -d
# Full: All services (Higher cost, development)
docker-compose up -d
# Test deployment
curl http://localhost:8000/health- LangChain Service: Fully implemented as a standalone service (not containerized in docker-compose, runs on port 8008 for local development).
- Trading Service: Multi-tier agent system with robust fallback logic, circuit breaker, and observability. LangChain AI integration is partially implemented.
- All other services, infrastructure, and observability components are implemented and deployed as described.
- Kafka topics and ports are current as of this revision.
- Deployment options (docker-compose, lite, Kubernetes, GCP Terraform) are production-ready and match the codebase.
| Phase | Component | Purpose | Status |
|---|---|---|---|
| Phase 1 | LangChain & Vector Services | AI/LLM management + RAG capabilities | β Operational |
| Phase 2 | Smart Trading & Observability | Trading logic + monitoring stack | β Operational |
| Phase 3 | Enhanced Multi-Agent Orchestrator | Microsoft Agent Framework coordination | β Operational |
- π Gateway (8000): API gateway and routing
- π€ Trading Service (8001): Multi-tier agent system with robust fallback logic, circuit breaker, and observability. LangChain AI integration is partially implemented (core trading logic and circuit breaker are production-ready; advanced LLM-driven features are in progress).
- π Market Data Service (8002): Real-time and historical market data with resilient data access and fallback logic.
- β‘ Vector Service (8006): RAG and semantic search, enhanced vector store (Pinecone, ChromaDB).
- π§ LangChain Service: Standalone AI/LLM management service (not containerized in docker-compose, runs on port 8008 for local development; no dedicated port in compose).
- π― Orchestrator Service (8007): Multi-agent workflow coordination, enhanced state management (Redis).
- π§ Microsoft Agent Framework: Multi-agent trading workflows
- π RAG-Enhanced Decisions: Knowledge-augmented trading strategies
- π LangGraph Orchestration: Complex multi-step trading workflows
- π― 4 Specialized Agents: Market Analyst, Risk Manager, Execution Strategist, Strategy Coordinator
- π 6 Trading Strategies: Momentum, mean reversion, breakout, earnings, sector rotation, risk arbitrage
- ποΈ Complete Observability: End-to-end tracing and monitoring (Prometheus, Jaeger, LangSmith, structured logging)
- π‘οΈ Circuit Breaker & Enhanced Error Handling: Implemented for robust service reliability
- Requirements Guide - Complete installation options and environment setup
- Local Development - Development environment configuration
- Testing Guide - Complete testing documentation
- Gateway - API gateway and routing
- Trading Service - AI-powered trading logic
- Vector Service - RAG and semantic search
- LangChain Service - AI/LLM management
- Orchestrator Service - Multi-agent coordination
- Market Data Service - Real-time market data
- Risk Service - Risk management and assessment
- Backtest Service - Strategy backtesting
- Notification Service - Alert system
- Enhanced Vector Service - RAG implementation details
- LangChain & LangSmith RAG - Advanced RAG configurations
- Service Technology Breakdown - Technical architecture details
- Frontend Deployment - UI deployment guide
# AI Models (optional for basic functionality)
OPENAI_API_KEY=your-key # OpenAI integration
AZURE_OPENAI_ENDPOINT=your-endpoint # Azure OpenAI
ANTHROPIC_API_KEY=your-key # Anthropic Claude
# Vector Store (ChromaDB works without keys)
VECTOR_STORE_TYPE=chromadb # or pinecone
PINECONE_API_KEY=your-key # optional cloud vector store
# Trading (for production)
ALPACA_API_KEY=your-key # Market data provider
DATABASE_URL=postgresql://... # Database connectionπ See Requirements Guide for complete configuration options
# Run all tests (149 tests, 37.8% code coverage)
pytest tests/unit/test_phase1_components.py tests/unit/test_phase2_components.py tests/unit/test_phase3_components.py tests/integration/test_complete_system_integration.py -v
# Quick development check
python tests/test_all_components.py
# Specific phase testing
pytest tests/unit/test_phase2_components.py -v # Smart Trading
pytest tests/unit/test_phase3_components.py -v # Enhanced Orchestration- Low Coverage: Only 37.8% code coverage (398/1054 lines)
- Happy-path Focus: Most tests verify basic functionality, not edge cases
- Mock-heavy: Many tests use simulated data instead of real market conditions
- Missing Scenarios: No tests for market crashes, API failures, high-frequency conditions
- No Stress Testing: No performance testing under extreme conditions
Before live trading, implement:
- Stress Testing: Market crash scenarios, flash crashes, extreme volatility
- Performance Testing: High-frequency trading, latency under load, throughput limits
- Chaos Engineering: Random service failures, network partitions, data corruption
- Integration Testing: Real broker APIs, actual market data feeds
- Regression Testing: Historical market events (2008, 2020 crashes, etc.)
π See Testing Guide for current testing documentation
# Single container with SQLite - Perfect for learning
docker-compose -f docker-compose.lite.yml up -d
# Or single container deployment
docker build -f Dockerfile.lite -t trading-agent:lite .
docker run -d -p 8000:8000 -v trading_data:/data trading-agent:liteInfrastructure: SQLite + In-memory cache + Local ChromaDB Suitable for: Learning, paper trading, strategy development
# Essential services with small cloud database
docker-compose -f docker-compose.micro.yml up -dInfrastructure: Small PostgreSQL + Redis + Basic monitoring Suitable for: Small live trading, personal bots, portfolios <$50k
# Build and deploy for development/testing (Higher cost)
docker-compose up --build
# Kubernetes (development environment)
kubectl apply -f kubernetes/| Tier | Cost/Month | Infrastructure | Use Case |
|---|---|---|---|
| Nano | $5-15 | SQLite + Local | Learning, Paper Trading |
| Micro | $25-50 | Small DB + Cache | Small Live Trading |
| Standard | $100-300 | Managed Services | Professional Trading |
| Enterprise | $500+ | Full Stack | Institutional Use |
π See Cost-Effective Deployment Guide for detailed cost analysis and optimization strategies
π See AI Latency Optimization Guide for solving critical AI performance issues
π See Future Implementation Roadmap for what needs to be completed to fix current issues
- All 3 Phases: Locally validated and operational
- 92 Tests: All passing across unit and integration suites
- Microsoft Agent Framework: Detected and functional
- Dependencies: Fully compatible (Python 3.11.14)
- CI/CD: Enhanced workflows operational
- Comprehensive test coverage (149 passing tests)
- Professional documentation structure
- Organized requirements management
- Basic error handling and fallbacks
-
Setup Development Environment:
pip install -r requirements/requirements.txt pip install -r requirements/requirements-dev.txt
-
Run Tests:
pytest tests/ -v -
Follow Documentation: See local-development.md
-
Submit PR: Create feature branch and submit pull request
Current Status: Educational/Development System
This system is well-architected for learning and development but requires significant implementation work to fix critical issues:
- AI Latency: LLM calls (2-15 seconds) still in execution path - dangerous for live trading
- Cost Risk: Uncontrolled API usage could cost $500-5000+/month
- Architecture: Fast execution components designed but not integrated
- Status: See Future Implementation Roadmap for required work
- β Extensive Backtesting: Limited historical data testing with simulated results
- β Circuit Breakers: No trading halts or emergency stop mechanisms
- β Position Limits: Basic risk limits (2% per position) but no dynamic enforcement
- β Real-time Risk Management: Simplified risk calculations, no real-time portfolio monitoring
- β Market Data Resilience: Basic error handling, no redundant data sources or connection recovery
- β Edge Case Testing: No tests for market crashes, flash crashes, or extreme volatility
- β High-Frequency Conditions: No testing under rapid market movements or high-volume scenarios
- β API Failure Handling: Limited testing of external service failures and timeouts
- β AI Latency Issues: LLM calls (2-15 seconds) in critical execution path - dangerous for real-time trading
- β AI Cost Explosion: Potential $500-5000+/month in API costs for frequent trading
- β Infrastructure Costs: Full stack requires $500-2000+/month for production-grade services
- β Regulatory Compliance: No compliance checks or audit trails
- β Stress Testing: No extreme market condition testing
- β Live Trading Integration: Mock trading implementation only
- Microservices architecture with proper separation
- Basic risk assessment framework
- Structured logging and monitoring setup
- AI/ML integration with fallback mechanisms
- AI in Execution Path: LLM calls (2-15 seconds) block time-critical trading decisions
- Cost Explosion Risk: Potential $500-5000+/month in AI API costs
- No Fast Execution: All trading decisions go through slow AI analysis
- 149 tests but only 37.8% code coverage (398/1054 lines covered)
- Limited edge case coverage: No tests for market crashes, API failures, or data delays
- No high-frequency testing: No performance or latency testing under load
- Mostly happy-path tests: Basic functionality verification, minimal error scenarios
- Mock-heavy testing: Many tests use simulated data rather than real market conditions
- Improve Test Coverage: Current 37.8% coverage needs to reach 80%+ for critical paths
- Add Edge Case Testing: Market crashes, flash crashes, extreme volatility scenarios
- Performance Testing: High-frequency trading conditions, latency under load
- API Resilience Testing: External service failures, timeouts, rate limiting
- CRITICAL: Separate AI from execution path - Current 2-15 second LLM calls are dangerous
- Implement fast execution engine - Target <100ms for trading decisions
- Add AI cost controls - Budget limits, caching, scheduled analysis
- Implement comprehensive backtesting with real historical data
- Add circuit breakers and emergency controls
- Enhance real-time risk monitoring and alerts
- Add market data redundancy and connection recovery
- Implement proper position sizing and exposure limits
- Add regulatory compliance checks and audit logging
- Conduct stress testing with extreme market scenarios
- Replace mock trading with real broker integrations
- Educational Purpose: This system is for educational and research purposes only
- Development Status: Requires significant production hardening before live trading
- Paper Trading: Use paper trading exclusively for testing strategies
- Risk Warning: Not suitable for live trading without extensive additional development
- Compliance: Ensure compliance with financial regulations before any trading use
- π Documentation:
docs/directory for detailed guides - π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Quick Scripts:
python check_dependencies.pyfor environment validation
MIT License - see LICENSE file for details.
Built with β€οΈ using Microsoft Agent Framework, LangChain, LangGraph, and modern AI technologies.
π― Educational/Development System - Requires additional production hardening before live trading.

