File size: 2,532 Bytes
1cdac12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
title: NSE Portfolio Optimizer Pro
emoji: πŸ“Š
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: "1.51.0"
app_file: app.py
pinned: false
license: mit
python_version: "3.11"
---

# πŸ“Š NSE Portfolio Optimizer Pro

**Real-time Portfolio Optimization for Indian Stock Market**

Built with Modern Portfolio Theory and advanced analytics.

## ✨ Features

### Portfolio Selection
- πŸ“ˆ **Live NIFTY 50** - Auto-fetched current constituents
- 🎯 **7 Sector Categories** - Banking, IT, FMCG, Pharma, Energy, Auto, Metals
- ✨ **Custom Portfolio** - Add your own stocks

### Advanced Analytics
- 🎲 **Monte Carlo Simulation** - 1000+ scenario analysis
- ⚠️ **Value at Risk (VaR)** - Downside risk quantification
- πŸ“ˆ **Efficient Frontier** - Interactive risk-return visualization
- πŸ”„ **Rolling Metrics** - Time-series performance analysis
- πŸ“‰ **Drawdown Analysis** - Peak-to-trough decline tracking
- πŸ“Š **Risk Contribution** - Individual stock risk breakdown

### Real-Time Data
- πŸ’Ή **Live Market Data** - Current prices, volumes, 52-week ranges
- 🏷️ **Automatic Sector Detection** - Using yfinance API
- πŸ”„ **Smart Caching** - Fast performance with fresh data

### Interactive Results
- 6 analysis tabs with professional visualizations
- Export CSV reports for further analysis
- Mobile-responsive interface

## πŸš€ How to Use

1. **Select Portfolio Mode**
   - Live NIFTY 50
   - Sector Focus (7 categories)
   - Custom Selection

2. **Configure Investment**
   - Investment amount (β‚Ή)
   - Historical data period
   - Risk parameters

3. **Analyze Results**
   - Allocation by sector
   - Efficient frontier plot
   - Monte Carlo scenarios
   - Risk metrics
   - Rolling performance
   - Live market data

## πŸ“Š Technologies

- **Streamlit 1.51.0** - Web framework
- **yfinance** - Market data
- **CVXPY** - Portfolio optimization
- **Plotly** - Interactive charts
- **NumPy/Pandas** - Data processing
- **SciPy** - Statistical analysis

## πŸ“– Methodology

**Modern Portfolio Theory (Markowitz, 1952)**
- Mean-Variance Optimization
- Sharpe Ratio Maximization
- Efficient Frontier Construction
- Monte Carlo Risk Simulation

## ⚠️ Disclaimer

**Educational purposes only.** This tool is for learning and research. It does not constitute financial advice. Always consult a qualified financial advisor before making investment decisions. Past performance does not guarantee future results.

## πŸ“„ License

MIT License

---

**Built with ❀️ for Indian Stock Market Investors**