Skip to content

Latest commit

Β 

History

History
100 lines (64 loc) Β· 2.32 KB

File metadata and controls

100 lines (64 loc) Β· 2.32 KB

πŸ“Š Eigen Portfolio Optimization

Harness the power of PCA and Eigen decomposition for smarter investing.

Welcome to Eigen Portfolio, a data science project that uses Principal Component Analysis (PCA) and eigen decomposition to create an optimized portfolio of assets. This project explores dimensionality reduction in finance and how eigenvectors and eigenvalues can guide investment strategies.


🧠 Core Idea

The goal is to analyze historical price data of multiple stocks and extract the principal components that explain the most variance. These components are then used to allocate weights to the assets, forming an optimal portfolio.

Key concepts include:

  • Covariance matrices
  • Eigenvalues & eigenvectors
  • PCA in financial markets
  • Portfolio variance & risk

πŸ“‚ Project Structure

Eigen-Portfolio/
β”œβ”€β”€ Eigen Portfolio.ipynb     # Main Jupyter notebook
β”œβ”€β”€ README.md                 # You're reading it!
└── data/                     # Historical stock data (if applicable)

βš™οΈ What the Notebook Covers

  • βœ… Data fetching using yfinance
  • βœ… Log returns computation
  • βœ… Covariance matrix and its decomposition
  • βœ… PCA-based portfolio construction
  • βœ… Eigen portfolio vs equal-weighted portfolio comparison
  • βœ… Visualization of risk-return tradeoff

πŸ“ˆ Sample Outputs

  • Scree plot of explained variance
  • Portfolio weights based on eigenvectors
  • Comparative performance graphs

πŸš€ How to Run

  1. Clone the repo:

    git clone [https://github.com/your-username/eigen-portfolio.git](https://github.com/your-username/eigen-portfolio.git)
    cd eigen-portfolio
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the notebook:

    Open Eigen Portfolio.ipynb in Jupyter Notebook or VSCode and run all cells.


πŸ“¦ Dependencies

  • numpy
  • pandas
  • matplotlib
  • yfinance
  • seaborn

Install all using:

pip install numpy pandas matplotlib yfinance seaborn

πŸ“š Learn More


πŸ§‘β€πŸ’» Author

Made with ❀️ by Shretima