# PyPortfolio/PyPortfolioOpt

Financial portfolio optimization in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity

Repository: https://github.com/PyPortfolio/PyPortfolioOpt
Canonical: https://ross.abutalabs.com/products/pyportfolioopt
Homepage: https://pyportfolioopt.readthedocs.io/
Language: Jupyter Notebook
License: MIT
License Family: permissive
Topics: finance, portfolio-optimization, portfolio-management, quantitative-finance, algorithmic-trading, investing, efficient-frontier, covariance, python, investment, investment-analysis, financial-analysis
Last push: 2026-07-07T21:18:14+00:00

## Health v2 (maintenance only)
Score: 75/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 40, longevity 100
- inputs: {"age_days": 3018, "days_push": 57, "days_rel": 188, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5983, forks 1171 (observed 2026-08-28T04:09:33.982616+00:00)

## What it is
PyPortfolioOpt is a Python library for financial portfolio optimization, implementing classical mean-variance optimization, Black-Litterman allocation, covariance shrinkage, and Hierarchical Risk Parity. It is designed in the spirit of scikit-learn to be extensive yet easily extensible for both casual investors and professional quants prototyping allocation strategies.

## Use cases
- compute the efficient frontier for a basket of stocks
- optimize portfolio weights to maximize Sharpe ratio
- apply Black-Litterman allocation with my own views
- run Hierarchical Risk Parity on asset returns
- combine multiple alpha sources into risk-efficient weights
- shrink a sample covariance matrix for more stable estimates
- prototype portfolio allocation strategies in Python

## When to choose
- you need well-tested portfolio optimization methods in Python with a scikit-learn-like API
- you want classical MPT, Black-Litterman, and HRP in one library
- you are prototyping allocation strategies or teaching quantitative finance
- you want a permissively licensed (MIT) library with good documentation

## When to avoid
- you need live market data feeds or backtesting engines - pair it with other tools
- you require high-frequency or execution-level trading infrastructure
- you need non-Python environments or GPU-accelerated large-scale optimization

## Facets
- artifact type: library
- maturity: stable
- function: math, data-science, trading
- domain: fintech, data-science, mathematics
- platform: python, cross-platform
- tags: portfolio-optimization, quantitative-finance, efficient-frontier, black-litterman, hierarchical-risk-parity, mean-variance, investing

## Member repositories
- PyPortfolio/PyPortfolioOpt (main) score 75

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:33.982616+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:49:52.788303+00:00, confidence not recorded.
  - readme: https://github.com/PyPortfolio/PyPortfolioOpt (fetched 2026-08-28T04:09:33.982616+00:00, sha 9469ab019abf)
  - registry_pypi: https://pypi.org/pypi/pyportfolioopt/json (fetched 2026-08-29T08:46:24.762273+00:00, sha 601b78bdb7f9)
- Data as of 2026-08-30T08:39:29.467469+00:00.
