An end-to-end ML-powered system that reads Indian macroeconomic regimes and predicts optimal Nifty sector allocation — with backtested outperformance vs NIFTY 50.
| Metric | Strategy | NIFTY 50 |
|---|---|---|
| CAGR | 71.98% | 9.48% |
| Sharpe Ratio | 2.72 | 0.64 |
| Max Drawdown | -16.23% | -29.62% |
| Hit Rate | 70.9% | — |
- Pulls live Indian market data — 8 Nifty sector indices, NIFTY 50, USD/INR, India VIX via yfinance
- Engineers macro features — VIX regime, NIFTY momentum, USD/INR trend
- Classifies macro regime — Expansion, Slowdown, Contraction, Stagflation using Random Forest (98.3% accuracy)
- Ranks sectors per regime — Random Forest regressors predict forward 1-month sector returns
- Constructs model portfolio — Equal weight across top 3 ranked sectors, monthly rebalancing
- Backtests vs NIFTY 50 — CAGR, Sharpe Ratio, Max Drawdown, Hit Rate
- Visualizes everything — Excel dashboard, 6 PNG charts
pip install pandas numpy matplotlib seaborn scikit-learn yfinance shap openpyxl jupyterpython src/pipeline.py
python src/feature_engineering.py
python src/train_model.py
python src/backtest.py
python src/visualize.py
python src/excel_dashboard.py| Source | Data |
|---|---|
| yfinance | 8 Nifty sector indices, NIFTY 50 benchmark |
| yfinance | USD/INR exchange rate, India VIX |
- Algorithm: Random Forest (multiclass)
- Features: VIX regime, NIFTY momentum (3M/6M/12M), USD/INR trend
- Output: Expansion / Slowdown / Contraction / Stagflation
- Accuracy: 98.3% (cross-validated)
- Algorithm: Random Forest Regressor (per regime)
- Target: Forward 1-month sector return
- Output: Ranked list of 8 sectors
- Portfolio: Equal weight in top 3 sectors, monthly rebalanced
| Regime | Conditions | Top Sectors |
|---|---|---|
| Expansion | NIFTY above MA, low VIX, positive momentum | Auto, Realty, Metal |
| Slowdown | NIFTY slowing, elevated VIX | Pharma, FMCG |
| Contraction | NIFTY below MA, high VIX | Pharma, FMCG, Infra |
| Stagflation | NIFTY down, INR weakening | Energy, Metal |
- Python — pandas, numpy, scikit-learn, yfinance, shap, matplotlib, openpyxl
- ML — Random Forest classifier + regressors, SHAP explainability
- Visualization — matplotlib (dark theme charts), openpyxl (Excel dashboard)
- Data — yfinance API (NSE indices)
Manav BTech CSE + MBA — Nirma University, Ahmedabad (2029) Targeting Investment Banking & Strategy Consulting
"I built a system that reads Indian macroeconomic regimes using live market data and predicts optimal Nifty sector allocation using machine learning — with a backtested portfolio delivering 71.98% CAGR vs 9.48% for NIFTY 50."