Welcome to the QuantTradeAI documentation! This comprehensive machine learning framework for quantitative trading strategies provides a complete pipeline from data acquisition to model training and backtesting.
- Configuration Overview - Choose the right config file for research, agents, and utility workflows
- Project Config (
project.yaml) - Canonical research, promotion, and agent configuration - Generated Runtime Files - Runtime YAML snapshots emitted from
config/project.yaml - Legacy Command Migration - Replacement paths for removed legacy commands
- API Documentation - Comprehensive reference for all public APIs, functions, and components
- Quick Reference Guide - Common usage patterns and examples
- LLM Sentiment Analysis - Configure LLM-based sentiment scoring
- Main README - Project overview and getting started guide
# Clone the repository
git clone https://github.com/AKKI0511/QuantTradeAI.git
cd QuantTradeAI
# Install dependencies
pip install poetry
poetry install# Canonical project workflow
poetry run quanttradeai init --template research -o config/project.yaml
poetry run quanttradeai validate -c config/project.yaml
poetry run quanttradeai research run -c config/project.yaml
poetry run quanttradeai runs list
# Runnable agent workflow
poetry run quanttradeai init --template llm-agent -o config/project.yaml
poetry run quanttradeai validate -c config/project.yaml
poetry run quanttradeai agent run --agent breakout_gpt -c config/project.yaml --mode backtest
poetry run quanttradeai agent run --all -c config/project.yaml --mode paper
# Lower-level utility commands that still exist
poetry run quanttradeai fetch-data -c config/model_config.yaml
poetry run quanttradeai evaluate -c config/model_config.yaml -m models/experiments/<timestamp>/<SYMBOL>
poetry run quanttradeai backtest -c config/backtest_config.yamlCanonical research runs also persist resolved configs and compiled runtime YAMLs
under runs/research/<timestamp>_<project>/.
Canonical agent backtests persist their artifacts under
runs/agent/backtest/<timestamp>_<agent>/.
The API Documentation provides comprehensive coverage of:
- Command Line Interface - CLI commands and entry points
- Data Loading and Processing - DataLoader, DataProcessor, and DataSource classes
- Feature Engineering - Technical indicators and custom features
- Machine Learning Models - MomentumClassifier and training utilities
- Backtesting Framework - Trade simulation and performance metrics
- Trading Utilities - Risk management, position sizing, real-time position control
- Utility Functions - Metrics, visualization, and configuration schemas
- Configuration - Canonical
project.yaml, generated runtime YAMLs, and migration guidance
The Quick Reference Guide includes:
- Quick Start - Basic setup and usage
- Common Patterns - Data loading, feature engineering, model training, backtesting
- Technical Indicators - Usage examples for all technical indicators
- Custom Features - Momentum score and volatility breakout functions
- Risk Management - Stop-loss, take-profit, drawdown guard, and position sizing
- Performance Metrics - Classification and trading metrics
- Visualization - Price charts and performance plots
- Configuration Guides - Purpose-built pages for project, generated runtime, and migration guidance
- Error Handling - Common error patterns and solutions
- Best Practices - Recommended approaches for each component
- Troubleshooting - Solutions for common issues
QuantTradeAI/
├── quanttradeai/
│ ├── cli.py # Typer CLI entry point
│ ├── main.py # Legacy CLI bridge + pipeline helpers
│ ├── agents/ # Agent runtime, prompts, and backtest orchestration
│ ├── data/ # Data processing
│ │ ├── loader.py # Data fetching and caching
│ │ ├── processor.py # Feature engineering
│ │ └── datasource.py # Data source abstractions
│ ├── features/ # Feature engineering
│ │ ├── technical.py # Technical indicators
│ │ └── custom.py # Custom features
│ ├── models/ # Machine learning
│ │ └── classifier.py # Voting classifier
│ ├── backtest/ # Backtesting
│ │ └── backtester.py # Trade simulation
│ ├── trading/ # Trading utilities
│ │ ├── drawdown_guard.py # Drawdown protection
│ │ ├── portfolio.py # Portfolio operations
│ │ ├── position_manager.py # Real-time position tracking
│ │ └── risk_manager.py # Risk coordination
│ └── utils/ # Utilities
│ ├── metrics.py # Performance metrics
│ ├── visualization.py # Plotting functions
│ └── config_schemas.py # Configuration validation
├── config/ # Configuration files
│ ├── model_config.yaml # Model parameters
│ ├── features_config.yaml # Feature engineering settings
│ └── risk_config.yaml # Drawdown and turnover limits
└── docs/ # Documentation
├── api/ # API documentation
├── quick-reference.md # Quick reference guide
└── README.md # This file
- Data Acquisition - Fetch OHLCV data from multiple sources
- Feature Engineering - Generate technical indicators and custom features
- Label Generation - Create trading signals based on forward returns
- Model Training - Train ensemble models with hyperparameter optimization
- Backtesting - Simulate trades with risk management
- Performance Analysis - Calculate metrics and generate reports
- Multi-source data fetching (YFinance, AlphaVantage)
- Intelligent caching with expiration
- Data validation and quality checks
- Parallel processing for multiple symbols
- Technical indicators (SMA, EMA, RSI, MACD, Stochastic, Bollinger Bands)
- Volume indicators (OBV, volume ratios)
- Custom features (momentum score, volatility breakout)
- Feature preprocessing (scaling, outlier handling)
- Ensemble models (Voting Classifier with Logistic Regression, Random Forest, XGBoost)
- Hyperparameter optimization using Optuna
- Cross-validation for robust evaluation
- Model persistence and loading
- Trade simulation with limit/stop orders and intrabar tick fills
- Adaptive market impact modeling with dynamic spreads and asymmetric coefficients
- Borrow fee accounting for short positions
- Risk management (stop-loss, take-profit)
- Performance metrics (Sharpe ratio, max drawdown)
- Position sizing based on risk parameters
- Stop-loss and take-profit rules
- Position sizing calculations
- Risk-adjusted returns analysis
- Drawdown and turnover guards
The framework is currently configured for:
- AAPL (Apple Inc.)
- META (Meta Platforms)
- TSLA (Tesla Inc.)
- JPM (JPMorgan Chase)
- AMZN (Amazon.com)
- Test new trading strategies
- Experiment with different feature combinations
- Optimize model hyperparameters
- Analyze strategy performance
- Train models for multiple assets
- Cross-validate model performance
- Save and load trained models
- Evaluate out-of-sample performance
- Simulate historical trading
- Test risk management rules
- Calculate performance metrics
- Generate equity curves
- Load trained models
- Make real-time predictions
- Implement risk management
- Monitor performance
- Data Loading: See DataLoader API
- Feature Engineering: See Feature Engineering API
- Model Training: See Machine Learning Models API
- Backtesting: See Backtesting Framework API
- Risk Management: See Trading Utilities API
- Getting Started: See Quick Reference Guide
- Configuration: See Configuration Overview
- Error Handling: See Troubleshooting
- Technical Indicators: See Technical Indicators API
- Performance Metrics: See Data Loading API
- Visualization: See Data Loading API
When contributing to the documentation:
- Update API Documentation - Add new functions and classes to the appropriate files in
api/ - Add Examples - Include usage examples in
quick-reference.md - Update Configuration - Document new configuration options
- Add Troubleshooting - Include solutions for common issues
- Include complete, runnable examples
- Show both simple and advanced usage
- Include error handling where appropriate
- Use consistent formatting and naming
- Document all public functions and classes
- Include parameter types and descriptions
- Provide return value descriptions
- Include usage examples
- Document all configuration options
- Provide example configurations
- Explain parameter effects
- Include validation rules
- Project Repository: GitHub
- Poetry Documentation: poetry.dev
- YFinance Documentation: yfinance
- Scikit-learn Documentation: scikit-learn
- XGBoost Documentation: XGBoost
For questions and support:
- Check the documentation - Most questions are answered in the API docs or quick reference
- Review examples - See the complete workflow examples
- Check configuration - Ensure your configuration files are correct
- Review troubleshooting - Common issues and solutions are documented
This documentation provides comprehensive coverage of the QuantTradeAI framework. Start with the Quick Reference Guide for common usage patterns, then refer to the API Documentation for detailed function references.