Home / Risk & portfolio
PyPortfolioOpt
Mean-variance, Black-Litterman and risk-parity portfolio optimization in Python
What it is
A Python library implementing financial portfolio optimization methods, spanning classical mean-variance optimization on the efficient frontier as well as Black-Litterman allocation, shrinkage estimators, and Hierarchical Risk Parity. Concretely, it estimates expected returns and covariance risk models, optimizes objective functions such as maximizing the Sharpe ratio, supports adding constraints or custom objectives, and can convert continuous weights into an actual allocation for a given portfolio size and recent prices. Inspired by scikit-learn, it is extensive yet easily extensible, making it a fit for casual investors as well as professionals seeking a prototyping tool for combining alpha sources in a risk-efficient way. Keep in mind that nothing in the project constitutes investment advice, and users remain responsible for their own investment decisions.
At a glance
RecommendedOur rating, based on popularity, maintenance and how ready it is for real use.
| Best for | Professional quants |
|---|---|
| Used for | Data analysis, Strategy research |
| Markets | Multi-market |
| Stack | Python |
| Learning curve | Moderate learning curve |
| Practical value | High practical value |
| Cost | Free and open source |
| Hardware | No GPU needed |
| Maintenance | Last commit 3 months ago |
GitHub stars, last 30 days
Daily snapshots since 2026-09-12 (up to 30 days): +68 over the period, now 6,091. Gaps mean no snapshot was taken that day.
Financial portfolio optimization in python, including classical efficient frontier and advanced methods.
Similar tools
Jupyter notebooks companion to Machine Learning for Trading
Goldman Sachs Python toolkit for derivatives and risk
scikit-learn compatible Python library for portfolio optimization
CVXPY-based portfolio optimization and strategic asset allocation
Python financial econometrics with ARCH, GARCH and volatility models
C++ financial research terminal with embedded Python analytics