How akshat-singh-kshatriya/ml-portfolio-optimization-and-backtesting works
The repository is a rolling ML-driven portfolio optimization and backtesting engine. Its workflow downloads asset and market prices, prepares features in PostgreSQL, forecasts asset returns, optimizes portfolio weights, and evaluates and plots the resulting backtest. The README documents PostgreSQL feature engineering and the execution order; the SQL source itself was not excerpted, so its detailed transformations and input wiring cannot be verified here.
Main entry points: data_extraction.py Price extraction · returns.sql Feature engineering · portfolio.py Rolling backtest
Components 12
Market data
- Price extraction
data_extraction.py - Asset prices CSV
- Nifty prices CSV
Feature engineering
- PostgreSQL
- Feature engineering
returns.sql - Portfolio features CSV
Portfolio engine
- Return forecasting
portfolio.py - Weight optimization
portfolio.py - Rolling backtest
portfolio.py - Metrics and plots
portfolio.py
Other components
- Operator
- Yahoo Finance
Connections 12
- Operator → Price extraction: runs
README.md - Price extraction → Yahoo Finance: downloads prices
data_extraction.py - Price extraction → Asset prices CSV: writes
data_extraction.py - Price extraction → Nifty prices CSV: writes
data_extraction.py - Operator → Feature engineering: runs
README.md - Feature engineering → PostgreSQL: engineers features
README.md - Feature engineering → Portfolio features CSV: produces
README.md - Operator → Rolling backtest: runs
README.md - Portfolio features CSV → Return forecasting: loads
portfolio.py - Return forecasting → Weight optimization: supplies forecasts
portfolio.py - Weight optimization → Rolling backtest: supplies weights
portfolio.py - Rolling backtest → Metrics and plots: supplies returns
portfolio.py