https://github.com/ronaldkanyepi/portfolio-optimization-pyomo
This project optimizes stock portfolios by selecting up to 10 tickers and a custom date range. Using Pyomo for optimization, it minimizes risk while targeting a desired return. The app displays portfolio allocations, expected returns, risk ceilings, and stock correlation heatmaps, with data sourced from yfinance
https://github.com/ronaldkanyepi/portfolio-optimization-pyomo
optimization-algorithms portfolio pyomo pyomo-library python risk-analysis risk-management standard-deviation steamlit stock-data stock-market stock-price-prediction stocks streamlit-webapp ticker variance
Last synced: 4 months ago
JSON representation
This project optimizes stock portfolios by selecting up to 10 tickers and a custom date range. Using Pyomo for optimization, it minimizes risk while targeting a desired return. The app displays portfolio allocations, expected returns, risk ceilings, and stock correlation heatmaps, with data sourced from yfinance
- Host: GitHub
- URL: https://github.com/ronaldkanyepi/portfolio-optimization-pyomo
- Owner: ronaldkanyepi
- License: mit
- Created: 2024-12-24T10:34:47.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-24T10:58:26.000Z (6 months ago)
- Last Synced: 2025-01-04T01:52:47.453Z (6 months ago)
- Topics: optimization-algorithms, portfolio, pyomo, pyomo-library, python, risk-analysis, risk-management, standard-deviation, steamlit, stock-data, stock-market, stock-price-prediction, stocks, streamlit-webapp, ticker, variance
- Language: Python
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Portfolio Optimization with Streamlit and Pyomo
This project optimizes stock portfolios by selecting up to 10 tickers and a custom date range. Using **Pyomo** for optimization, it minimizes risk while targeting a desired return. The app displays portfolio allocations, expected returns, risk ceilings, and stock correlation heatmaps, with data sourced from **yfinance**.
## Features
- **Stock Ticker Selection**: Select up to 10 stock tickers.
- **Date Range**: Choose a custom start and end date.
- **Optimization**: Minimize portfolio risk while maintaining a desired return.
- **Display**: View portfolio allocation, max return, risk ceiling, and a heatmap of stock correlations.## Why Start and End Dates are Required
- The start and end dates define the period for which stock data is fetched and analyzed. These dates allow the app to calculate historical returns and perform portfolio optimization based on the chosen timeframe. By selecting specific dates, users can analyze stocks under different market conditions and tailor the optimization to their desired time horizon.## Setup Instructions
### 1. Create a Virtual Environment
```bash
python -m venv venv
```
Activate the virtual environment:
- **Windows**: `venv\Scripts\activate`
- **MacOS/Linux**: `source venv/bin/activate`### 2. Install Dependencies
`pip install -r requirements.txt`- Or manually install:
`pip install streamlit pyomo yfinance seaborn matplotlib numpy pandas`### 3. Install IPOPT Solver
**Windows**: Download IPOPT from COIN-OR IPOPT and add ipopt.exe to your PATH.### 3. Install IPOPT Solver
**Windows**: Download IPOPT from COIN-OR IPOPT https://github.com/coin-or/Ipopt/releases and add ipopt.exe to your PATH.**MacOS/Linux**: Install using brew (MacOS) or apt-get (Ubuntu).: Install using brew (MacOS) or apt-get (Ubuntu).
### 4. Run the App
streamlit run main.py### 5. Demo

