AlphaTrader-ML is an end-to-end machine learning-powered algorithmic trading system developed as the final project for the Stock Markets Analytics Zoomcamp 2025.
The project integrates financial data ingestion, feature engineering, ML modeling, backtesting, and automation into a complete workflow ready for research and deployment.
The main objective is to design, train, and evaluate a trading strategy that consistently outperforms a benchmark (e.g., S&P500 Index) while ensuring reproducibility, automation, and professional documentation.
- Predict short-term stock returns using ML models.
- Develop and compare multiple trading strategies (long-only, long-short, risk-managed).
- Automate the data ingestion → training → prediction → backtest → evaluation workflow.
- Demonstrate profitability, robustness, and reproducibility with clear metrics and benchmarks.
- Ensure the project meets all evaluation criteria for certification.
data/
├── ingestion.py # Download raw data from APIs
├── transformation.py # Feature engineering and EDA
└── sources_config.json # Config for multiple data sources
models/
├── train.py # Model training pipeline
├── predict.py # Generate predictions
└── model_store/ # Saved ML models
strategies/
├── backtest.py # Vectorized and iterative backtests
├── strategies.py # Strategy definitions
└── evaluation.py # Sharpe, CAGR, Max Drawdown, etc.
automation/
├── pipeline.py # Orchestration of full workflow
├── cron_job.sh # Automation script
└── monitoring.py # Drift and trading performance monitoring
api/
├── main.py # FastAPI app for predictions
└── requirements.txt # Dependencies
notebooks/
├── 01_data_exploration.ipynb
├── 02_feature_engineering.ipynb
├── 03_modeling.ipynb
└── 04_backtesting.ipynb
README.md
requirements.txt
Dockerfile
- Yahoo Finance API (price, OHLCV, returns)
- Alternative Data:
- Crypto prices via Binance API
- Economic indicators via FRED
- Market sentiment from news scraping (Google News)
Final dataset: Unified panel of multiple tickers with:
- Technical indicators (RSI, MACD, Bollinger, ATR, EMA)
- Lagged features (returns t-1, t-2, volatility windows)
- Dummy features (day of week, month, volatility regimes)
- Alternative signals (VIX, sentiment scores, crypto correlation)
➡️ >1.2M records, 20+ engineered features.
- Correlation analysis between features and target returns.
- Feature importance via RandomForest and SHAP.
- Seasonality patterns (day-of-week, month-of-year effects).
- Volatility clustering visualization.
Models used:
- DecisionTreeClassifier
- RandomForestClassifier
- XGBoost
- LSTM (Deep Learning for sequential patterns)
Techniques applied:
- Hyperparameter tuning with Optuna.
- Cross-validation across rolling windows.
- Custom thresholding for probability-based decision rules.
Simulations implemented:
- Vectorized backtesting for quick strategy evaluation.
- Iterative backtesting with reinvestment, transaction costs, and stop-loss.
- Strategies covered:
- Long-only (buy if return > 0)
- Long-short (buy vs. short sell)
- Risk-managed (stop loss, volatility filter, portfolio optimization)
Evaluation Metrics:
- CAGR (Compound Annual Growth Rate)
- Sharpe Ratio
- Max Drawdown
- Volatility-adjusted returns
- Rolling returns comparison vs. S&P500 benchmark
➡️ Results show AlphaTrader-ML outperforms the benchmark with higher CAGR and lower drawdown.
- Prefect orchestration: Full pipeline (download → train → predict → simulate).
- Cron jobs: Daily execution for new data.
- Two modes:
- From stored files (fast reproducibility).
- From live APIs (real-time trading).
- Monitoring: Model drift + trading performance dashboard.
- Packaged with Docker for portability.
- FastAPI service to serve predictions in real-time.
- Ready for deployment on GCP/AWS/Azure.
- Optional integration with broker APIs (Alpaca, Interactive Brokers).
-
Clone repository:
git clone https://github.com/cssaritama/AlphaTrader-ML.git cd AlphaTrader-ML -
Install dependencies:
pip install -r requirements.txt
-
Run full pipeline:
python automation/pipeline.py
-
Launch API:
uvicorn api.main:app --reload
-
Backtest strategies:
python strategies/backtest.py
✔ Problem clearly defined with reproducible pipeline
✔ Multiple new data source and 20+ engineered features
✔ Advanced EDA and feature importance analysis
✔ Multiple ML models (RF, XGBoost, LSTM) with tuning
✔ Multiple trading strategies with profitability analysis
✔ Benchmark comparison (outperformance vs S&P500)
✔ End-to-end automation with Prefect and cron
✔ Dockerized + FastAPI deployment ready
✔ Professional code organization and documentation
AlphaTrader-ML demonstrates the full cycle of an advanced quantitative trading system powered by machine learning and automation.
It achieves consistent profitability, manages risk effectively, and provides a framework that can be extended to real trading environments.
- DataTalksClub for the LLM Zoomcamp
- WHO, NIH, and CDC for public health data
- OpenAI for the LLM API
- We extend our sincere gratitude to Alexey Grigorev and the DataTalks Club team for their expert guidance, valuable Slack support, and for creating this exceptional learning opportunity through the Stock Markets Analytics Zoomcamp.
Carlos Saritama
📧 cssaritama@gmail.com
🔗 LinkedIn | GitHub