TradPal is a fully autonomous AI trading system based on a complete microservices architecture. The goal is consistent outperformance of Buy&Hold and traditional indicators through advanced ML models, ensemble methods, and risk management.
- 98 Test Files: Comprehensive test coverage with organized test structure (unit/integration/services/e2e)
- Service Consolidation: Partial consolidation of 25+ services into unified trading, data, and backtesting services
- Advanced ML Integration: ML-enhanced signal generation with ensemble methods and risk management
- Modular Data Sources: Kaggle Bitcoin Datasets, Yahoo Finance, CCXT integration for optimal backtesting
- Centralized Test Suite: Organized test structure with conftest.py, fixtures, and comprehensive coverage
tradpal/
βββ services/ # Microservices Architecture (25+ services, partial consolidation)
β βββ core/ # Core calculations & Memory optimization
β βββ data_service/ # Data Management (CCXT, Kaggle, Yahoo Finance, caching, HDF5)
β β βββ data_sources/ # Modular data sources (Kaggle Bitcoin Datasets, Exchanges)
β β βββ liquidation.py # Liquidation data with fallback chain
β β βββ volatility.py # Volatility indicators as liquidation proxy
β β βββ sentiment.py # Sentiment analysis data source
β β βββ onchain.py # On-chain metrics data source
β β βββ factory.py # Data source factory with 8+ sources
β βββ trading_service/ # Consolidated AI-powered trading service
β β βββ orchestrator.py # Main trading orchestrator
β β βββ execution/ # Order execution
β β βββ risk_management/ # Risk management
β β βββ reinforcement_learning/ # RL agents
β β βββ market_regime/ # Market regime detection
β β βββ monitoring/ # Trading monitoring
β βββ backtesting_service/ # Historical simulation and ML training
β βββ discovery_service/ # ML parameter optimization
β βββ risk_service/ # Risk management and position sizing
β βββ notification_service/ # Alerts (Telegram, Discord, Email)
β βββ mlops_service/ # ML experiment tracking and model management
β βββ security_service/ # Zero-trust authentication
β βββ event_system/ # Event-Driven Architecture (Redis Streams)
β βββ api_gateway/ # Centralized service routing and authentication
β βββ [20+ additional services]/ # Individual microservices (pending consolidation)
βββ config/ # Central configuration
β βββ settings.py # Main configuration (imports from modules)
β βββ core_settings.py # Core trading and risk management
β βββ ml_settings.py # Machine learning and AI configurations
β βββ service_settings.py # Microservices and data mesh settings
β βββ security_settings.py # Security and authentication settings
β βββ performance_settings.py # Performance optimization settings
β βββ .env # Environment variables
β βββ .env.example # Example configuration
β βββ .env.light # Light profile (without AI/ML)
β βββ .env.heavy # Heavy profile (full features)
βββ tests/ # Centralized test suite (98 test files)
β βββ conftest.py # Central test configuration and fixtures
β βββ unit/ # Unit tests (25+ files)
β βββ integration/ # Integration tests (13+ files)
β βββ services/ # Service-specific tests
β βββ e2e/ # End-to-end tests
β βββ config/ # Configuration tests
β βββ integrations/ # Integration setup tests
βββ scripts/ # Utility scripts for training/demos
βββ examples/ # Jupyter notebooks and demos
βββ integrations/ # External integrations
βββ docs/ # Documentation
βββ main.py # Hybrid orchestrator with service clients
βββ pyproject.toml # Python project configuration
# One-time setup
make setup
# Start services
make dev-up
# Open Web UI (optional)
make dev-uiAvailable Services:
- π Data Service: http://localhost:8001
- π Backtesting Service: http://localhost:8002
- π¨ Web UI: http://localhost:8501
- π API Gateway: http://localhost:8000
- π‘ Event Service: http://localhost:8011
- π Monitoring: http://localhost:9090 (Prometheus), http://localhost:3000 (Grafana)
Useful Commands:
make test # Run tests
make backtest # Run backtest
make quality-check # Check code quality
make help # Show all commandsπ Detailed Guide
- Python 3.10+
- Conda/Miniconda
- Git
-
Clone repository:
git clone https://github.com/wurstgulasch/tradpal.git cd tradpal_indicator -
Set up environment:
conda env create -f environment.yml conda activate tradpal-env
-
Configuration:
cp config/.env.example config/.env # Edit .env file -
Run tests:
pytest tests/
# Live trading with light profile (without AI)
python main.py --profile light --mode live
# Backtest with all features
python main.py --profile heavy --mode backtest --start-date 2024-01-01
# Performance benchmark
python scripts/performance_benchmark.pyThe test suite follows best practices for microservices:
- Unit Tests (
tests/unit/): Isolated component tests - Integration Tests (
tests/integration/): Service interactions - Service Tests (
tests/services/): Service-specific tests
# All tests
pytest
# Unit tests only
pytest tests/unit/
# Service-specific tests
pytest tests/services/core/
# Integration focus areas
pytest tests/integration/test_market_regime_service.py
pytest tests/integration/test_reinforcement_learning_service.pyCurrent benchmarks show significant improvements:
- Memory Optimization: 10.25x faster than traditional methods, constant memory usage (~85 MB)
- GPU Acceleration: 3-12x faster training and inference depending on model type
- Parallel Processing: 4-8x faster on multi-core systems
- Intelligent Caching: 10-100x faster for repeated operations
- Vectorization: 5-15x faster indicator calculations
- Test Coverage: 100% for implemented features (537 tests passing)
- Data Sources: Modular architecture with Kaggle Bitcoin Datasets, Yahoo Finance, CCXT for improved backtesting
Detailed benchmarks: docs/PERFORMANCE_ENHANCEMENTS.md
TradPal offers a modular data sources architecture for optimal backtesting results:
- Kaggle Bitcoin Datasets: High-quality historical Bitcoin data with minute resolution
- Yahoo Finance: Stocks, ETFs and cryptocurrencies
- CCXT Integration: 100+ crypto exchanges for live data
- Alternative Data Sources: Sentiment analysis, on-chain metrics, volatility indicators
When primary liquidation data is unavailable (API authentication issues), the system automatically falls back to alternative data sources:
from services.data_service.data_sources.factory import DataSourceFactory
# Automatic fallback chain: Liquidation β Volatility β Sentiment β On-Chain β Open Interest
liquidation_source = DataSourceFactory.create_data_source('liquidation')
data = liquidation_source.fetch_recent_data('BTC/USDT', '1h', limit=100)
# Data will contain either real liquidation data or proxy data from alternative sources
# with 'data_source' field indicating which fallback was used- Fear & Greed Index: Real-time market sentiment from Alternative.me
- Social Sentiment: Simulated social media sentiment analysis
- News Sentiment: Market news sentiment indicators
- Market Sentiment: Overall market psychology proxy
- Active Addresses: Daily active blockchain addresses
- Transaction Volume: On-chain transaction volumes
- Hash Rate: Network mining difficulty proxy
- Exchange Flows: Net capital flows to/from exchanges
- Open Interest: Futures market positioning
- 24h Volume: Trading volume analysis
- Funding Rates: Perpetual futures funding rates
- Order Book: Market depth and bid-ask spreads
- Recent Trades: Trade flow analysis and momentum
- Automatic OHLC validation
- NaN value handling
- Consistent data formats
- Chunked processing for large datasets
- Microservices-First: Every new functionality as a separate service
- Event-Driven: Redis Streams for real-time service communication
- API Gateway: Centralized service routing, authentication, and load balancing
- Zero-Trust-Security: mTLS, OAuth/JWT, secrets management
- Observability: Prometheus/Grafana monitoring, distributed tracing, metrics, logs
- Resilience: Circuit breaker, retry patterns, health checks, chaos engineering
TradPal uses a sophisticated dependency management system designed for microservice independence:
- Single Source of Truth:
dependency_catalog.txtdefines approved package versions - Version Consistency: All services use exact versions from the catalog
- Automated Validation: Scripts ensure compliance across all services
Each service in services/ has its own requirements.txt with:
- Only packages the service actually needs
- Exact pinned versions from the catalog
- Independent deployment capability
# Validate all service dependencies
python scripts/manage_dependencies.py validate
# List all approved dependencies
python scripts/manage_dependencies.py list
# Update package version across all services
python scripts/manage_dependencies.py update <package> <version>- True Microservice Independence: Services can be deployed without shared dependencies
- Version Drift Prevention: Automated validation prevents conflicts
- Simplified Updates: Single command updates versions across all services
- Clean Architecture: No dependency conflicts between services
- Create service in
services/ - Add tests in
tests/services/ - Update documentation
- Extend CI/CD pipeline
- Type Safety: Complete type hints
- Testing: >90% coverage, integration tests
- Linting: flake8, mypy
- Formatting: black, isort
β Completed:
- Event-Driven Architecture with Redis Streams
- API Gateway with service discovery and load balancing
- Centralized monitoring with Prometheus/Grafana
- Circuit breaker and health check resilience patterns
π In Progress:
- AI Outperformance: ML models that consistently outperform benchmarks
- Service Optimization: Performance, scalability, reliability
- Advanced Features: Reinforcement learning, market regime detection, alternative data
- Data Sources Expansion: Additional datasets and real-time feeds for improved backtesting
- Enterprise Readiness: Security, monitoring, deployment automation
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Write tests
- Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Create Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
- Issues: GitHub Issues
- Documentation: docs/
- Examples: examples/
TradPal v2.5.1 - Last updated: October 21, 2025