PyPortfolioOpt implements mean-variance optimization, Black-Litterman allocation, hierarchical risk parity, and related portfolio methods with scikit-learn-style APIs.
Overview
PyPortfolioOpt helps quantitative investors and researchers combine alpha sources under explicit risk models. It modularizes expected return estimators, covariance shrinkage techniques, objective functions, and optimizers so components can be swapped.
Classical Markowitz efficient-frontier workflows sit alongside modern allocators such as Black-Litterman and HRP. Utilities discretize continuous weights into investable share counts given prices and budget constraints.
The library documents tutorials and cookbooks on ReadTheDocs, ships with Jupyter examples, and integrates with pandas-oriented data preparation. It emphasizes extensibility for casual prototyping and professional experimentation alike.
Source emphasizes that nothing in the project constitutes investment advice; users supply their own return and risk estimates.
Key features
- Mean-variance optimization
- Black-Litterman allocation
- Hierarchical risk parity
- Covariance shrinkage estimators
- Expected return models
- Discrete allocation helper
- pandas-friendly workflows
- Modular optimizer components
Use cases
- Long-only Sharpe maximization
- Risk-parity portfolio design
- Research backtests on equities
- Teaching modern portfolio theory