This project is a Python-based portfolio optimization engine that uses financial data to construct and analyze investment portfolios. It leverages the PyPortfolioOpt library to optimize asset allocation for maximum Sharpe ratio, minimum volatility, and to visualize the efficient frontier. The system also includes backtesting and comparison with an equal-weight portfolio, providing clear performance metrics and visualizations.
- Downloads historical price data for selected assets using yfinance
- Computes expected returns and covariance matrix
- Optimizes portfolio using PyPortfolioOpt (max Sharpe, min volatility)
- Generates and plots the efficient frontier
- Simulates and plots cumulative returns
- Compares optimized vs equal-weight portfolios
- Fork this repository on GitHub to your own account.
- Clone your fork to your local machine:
git clone https://github.com/your-username/portfolio-optimization-engine.git
- Install dependencies (preferably in a virtual environment):
pip install -r requirements.txt
- Run the main script:
python -m portfolio_opt.main
- Modify tickers or parameters in
main.pyas needed for your own analysis.
For questions or contributions, please fork and submit a pull request.