An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          


Portfolio Optimizer Banner

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 app

main.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