Production-Ready Quantitative Trading System with Daily MLOps Pipeline
Machine-learning driven portfolio allocation for CAC40, with a reusable architecture that can be extended to additional markets.
π Live Dashboard β’ π Performance β’ ποΈ Architecture β’ π Quick Start β’ π Issues
AlphaEdge is a quantitative portfolio management project that combines feature engineering, ensemble machine learning, portfolio optimization, and a Streamlit dashboard in a single codebase.
The current repository is organized around a CAC40 production setup, while keeping reusable modules for extension to other universes and market configurations.
- Ensemble modeling with XGBoost, LightGBM, Ridge, and Logistic Regression stacking
- Market regime detection using K-Means on technical features
- Walk-forward validation to evaluate temporal robustness before promotion
- Mean-variance optimization with PyPortfolioOpt
- Ledoit-Wolf covariance shrinkage for more stable risk estimates
- Monthly rebalancing with transaction cost handling and fallback allocation logic
- MLflow-based registry / promotion workflow for model tracking
- Local model fallback with
ensemble_model.pklandmodel_card.json - Automated workflows under
.github/workflows/for training, releases, and updates
- Streamlit dashboard for performance monitoring and signal inspection
- Dashboard screenshots already included in
images/ - Changelog and contribution files maintained at repository root
The dashboard section can display strategy return, benchmark comparison, drawdown, and signal information.
If you want this README to stay strictly accurate over time, update the numeric metrics directly from the latest dashboard or backtest output before each release.
graph TB
A[Market Data] --> B[ETL Pipeline]
B --> C[Feature Engineering]
C --> D[AlphaEdge Ensemble]
D --> E[Backtest & Signal Engine]
E --> F[Portfolio Optimization]
F --> G[Artifacts / Model Cards / Signals]
G --> H[Streamlit Dashboard]
D -.-> I[MLflow Registry]
- Extraction layer: market data loading and preprocessing
- Feature layer: momentum, volatility, risk-adjusted, and technical features
- Model layer: ensemble training, cross-validation, model loading, and promotion logic
- Pipeline layer: ETL, backtest, and daily execution utilities
- Presentation layer: Streamlit app for monitoring results
- Python 3.10+
- Git
- Recommended: virtual environment
- Optional:
HF_TOKENfor remote sync / registry integration
git clone https://github.com/SORADATA/CAC40-Quantitative-Analysis-Predictive-Asset-Allocation.git
cd CAC40-Quantitative-Analysis-Predictive-Asset-Allocation
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtstreamlit run app.pypython src/pipeline/daily_run.pypython src/models/train.py.
βββ .github
β βββ workflows
β βββ daily_update.yml
β βββ ml_pipeline.yml
β βββ pre-release.yml
β βββ python-app.yml
β βββ release.yml
βββ CHANGELOG.md
βββ CONTRIBUTING.md
βββ README.md
βββ app.py
βββ config
β βββ markets
β βββ cac40.json
βββ const.py
βββ debug_run.txt
βββ dev.sh
βββ images
β βββ Dashboard.png
β βββ Signal.png
βββ notebooks
β βββ 01_EDA.ipynb
βββ requirements.txt
βββ src
β βββ extract
β β βββ extractor.py
β β βββ yfinance_downloader_test.py
β βββ features
β β βββ alpha_features.py
β βββ models
β β βββ CAC40
β β β βββ ensemble_model.pkl
β β β βββ model_card.json
β β βββ US_TECH
β β β βββ ensemble_model.pkl
β β β βββ model_card.json
β β βββ __init__.py
β β βββ cv.py
β β βββ ensemble.py
β β βββ ensemble_model.pkl
β β βββ model_card.json
β β βββ model_loader.py
β β βββ train.py
β βββ pipeline
β β βββ backtest.py
β β βββ daily_run.py
β β βββ etl.py
β βββ transform
β β βββ processor.py
β β βββ ticker_manager.py
β βββ utils
β βββ config_loader.py
β βββ feature_utils.py
β βββ logger.py
β βββ market_utils.py
β βββ math_utils.py
β βββ metrics.py
βββ tests
βββ get_composition.py
βββ plot_results.py
βββ test_pipeline.py
Create a new JSON file in config/markets/, for example:
{
"market_name": "SP500",
"tickers": ["AAPL", "MSFT", "GOOGL", "AMZN", "NVDA"],
"benchmark_ticker": "^GSPC"
}Then adapt the training and pipeline entry points so the new configuration is discovered and processed consistently.
| Parameter | Role |
|---|---|
SHARPE_THRESHOLD |
Promotion safety threshold |
MAX_DD_THRESHOLD |
Max drawdown safety filter |
PROBA_MIN |
Minimum prediction probability for selection |
MAX_STOCKS_SELECT |
Maximum number of selected assets |
MIN_STOCKS_OPTIM |
Minimum assets required for optimizer |
TRANSACTION_COST |
Cost applied at rebalance |
BACKTEST_YEARS |
Lookback window used in backtesting |
The project computes momentum, mean-reversion, volatility, technical, and risk-adjusted features inside src/features/alpha_features.py.
This layer is central because it transforms raw price history into the model inputs used for ranking and allocation.
The training logic lives in src/models/train.py, while the ensemble definition is implemented in src/models/ensemble.py.
Model loading and champion selection behavior are handled through src/models/model_loader.py plus local fallback artifacts.
The simulation and rebalance logic are implemented in src/pipeline/backtest.py.
This is where signal generation, allocation logic, and portfolio performance evaluation come together.
Contributions are welcome through issues, discussions, and pull requests.
Before opening a PR, run formatting, linting, and tests locally where applicable.
black src/ --check
flake8 src/
pytest tests/This repository is for educational and research purposes only.
It does not constitute financial advice, and past performance does not guarantee future results.
Developed as part of the Master 2 - Statistics Expertise for Finance & Economics program at UniversitΓ© de Lorraine.
Thanks to the open-source ecosystem around Streamlit, scikit-learn, XGBoost, LightGBM, PyPortfolioOpt, and MLflow.
Developed by SORADATA

