https://github.com/thesangamx/portfolio-optimizer
Portfolio Optimizer is a Streamlit-based web application that helps users optimize their stock portfolios using historical data and the Sharpe Ratio. It supports both global and Indian stock tickers and provides visualizations, expected return, volatility, and Sharpe ratio for the optimal portfolio.
https://github.com/thesangamx/portfolio-optimizer
portfolio-optimization python sharpe-ratio stock-market streamlit
Last synced: 6 months ago
JSON representation
Portfolio Optimizer is a Streamlit-based web application that helps users optimize their stock portfolios using historical data and the Sharpe Ratio. It supports both global and Indian stock tickers and provides visualizations, expected return, volatility, and Sharpe ratio for the optimal portfolio.
- Host: GitHub
- URL: https://github.com/thesangamx/portfolio-optimizer
- Owner: TheSangamX
- Created: 2025-04-10T16:36:29.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-10T19:13:00.000Z (6 months ago)
- Last Synced: 2025-04-10T19:47:38.959Z (6 months ago)
- Topics: portfolio-optimization, python, sharpe-ratio, stock-market, streamlit
- Language: Python
- Homepage:
- Size: 1.83 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![]()
Portfolio Optimizer is a Streamlit-based web app that helps users optimize their stock portfolios using historical price data and the Sharpe Ratio.
๐ Supports both Indian (e.g., TCS.NS) and global (e.g., AAPL) stocks.
๐ Visualizes optimized weights, expected returns, volatility & Sharpe Ratio using interactive charts.# ๐ Portfolio Optimizer
A Streamlit web app to optimize a stock portfolio using the Sharpe Ratio.
Supports both Indian (e.g., HDFCBANK.NS) and US/global stocks (e.g., AAPL, MSFT).## ๐ง Features
- ๐ฅ Fetches historical stock data from Yahoo Finance
- ๐ Choose custom date range
- ๐ Calculates:
- Expected annual return
- Portfolio volatility
- Sharpe Ratio
- Optimal stock weights
- ๐ Visualizes portfolio allocation## ๐ How to Use
1. Enter stock tickers separated by comma
Example: `AAPL, MSFT, GOOGL, HDFCBANK.NS`
2. Select start and end dates
3. Click **Optimize Portfolio**## ๐ Run Locally
```bash
git clone https://github.com/TheSangamX/portfolio-optimizer.git
cd portfolio-optimizer
pip install -r requirements.txt
streamlit run streamlit_app.py
๐งพ Files Included
streamlit_app.py โ Streamlit web appmain.py โ (Optional core logic file)
requirements.txt โ Required Python packages
README.md โ App documentation
๐ Notes
Add .NS suffix for Indian stocks (e.g., TCS.NS, RELIANCE.NS)App uses Yahoo Finance (via yfinance) for data
Ensure internet connection when fetching live data
Made with โค๏ธ by Sangam Gupta