{
  "slug": "pyportfolioopt",
  "name": "PyPortfolioOpt",
  "aliases": [
    "pypfopt"
  ],
  "vendor": {
    "name": "Robert Andrew Martin and contributors",
    "slug": "pyportfolio",
    "website": "https://pyportfolioopt.readthedocs.io"
  },
  "homepage_url": "https://pyportfolioopt.readthedocs.io/en/latest/",
  "docs_url": "https://pyportfolioopt.readthedocs.io/en/latest/",
  "repo_url": "https://github.com/PyPortfolio/PyPortfolioOpt",
  "license_url": "https://github.com/PyPortfolio/PyPortfolioOpt/blob/main/LICENSE",
  "product_type": "library",
  "product_status": "active",
  "summary": "Python library for portfolio optimization: efficient frontier, Black-Litterman, hierarchical risk parity and discrete allocation",
  "description": "PyPortfolioOpt is an open-source Python library for portfolio optimization created by Robert Andrew Martin and now maintained under the PyPortfolio organisation. It implements the classical mean-variance efficient frontier with pluggable expected-return and risk-model estimators (sample, exponentially weighted, shrinkage), Black-Litterman views blending, CVaR and semivariance objectives, hierarchical risk parity, and a discrete allocation step that converts weights into whole-share positions for a given budget. Optimization is expressed through cvxpy, so custom constraints and objectives can be added. It suits analysts and students who want transparent allocation code on top of pandas price data. It is not a backtester or data source, assumes inputs are already clean, and large universes or complex constraints can hit solver limits.",
  "capabilities": [
    "Mean-variance optimization with custom constraints via cvxpy",
    "Return and risk estimators including shrinkage covariance",
    "Black-Litterman model with investor views",
    "Hierarchical risk parity and CVaR/semivariance objectives",
    "Discrete allocation to whole shares"
  ],
  "workflows": [
    "Estimate returns and covariance from prices, optimize for maximum Sharpe, then allocate a budget",
    "Blend market-implied returns with analyst views via Black-Litterman"
  ],
  "advantages": [
    "Readable API suited to teaching",
    "MIT license",
    "Extensible objectives and constraints"
  ],
  "limitations": [
    "No backtesting or data retrieval",
    "Solver performance degrades with large universes or many constraints"
  ],
  "prerequisites": [
    "Python with pandas, NumPy, SciPy and cvxpy"
  ],
  "audiences": [
    "Finance students",
    "Analysts prototyping allocation models"
  ],
  "alternatives": [
    "riskfolio-lib",
    "quantlib",
    "scipy"
  ],
  "comparison_notes": "Riskfolio-Lib covers a wider set of risk measures and optimization models and leans on the same cvxpy stack; PyPortfolioOpt is smaller and simpler to read. QuantLib addresses instrument pricing rather than allocation.",
  "categories": [
    {
      "slug": "portfolio-management",
      "primary": true
    },
    {
      "slug": "financial-analysis-investing"
    }
  ],
  "tags": [
    "portfolio-optimization",
    "python",
    "open-source",
    "cvxpy"
  ],
  "use_cases": [
    "optimize-portfolios"
  ],
  "operating_systems": [
    "macos",
    "linux",
    "windows"
  ],
  "execution_modes": [
    "local"
  ],
  "interfaces": [
    "library"
  ],
  "integrations": [
    "pandas",
    "cvxpy",
    "scikit-learn"
  ],
  "data_formats": [
    "pandas DataFrame"
  ],
  "languages": [
    "Python"
  ],
  "source_model": "open-source",
  "license_spdx": "MIT",
  "pricing_model": [
    "open-source",
    "free"
  ],
  "self_hostable": true,
  "sources": [
    {
      "url": "https://pyportfolioopt.readthedocs.io/en/latest/",
      "type": "official_site",
      "supports": [
        "name",
        "summary",
        "capabilities"
      ],
      "checked_at": "2026-11-02",
      "title": "PyPortfolioOpt documentation"
    },
    {
      "url": "https://github.com/PyPortfolio/PyPortfolioOpt",
      "type": "repository",
      "supports": [
        "product_status",
        "languages"
      ],
      "checked_at": "2026-11-02",
      "title": "PyPortfolio/PyPortfolioOpt"
    },
    {
      "url": "https://github.com/PyPortfolio/PyPortfolioOpt/blob/main/LICENSE",
      "type": "license_page",
      "supports": [
        "license_spdx"
      ],
      "checked_at": "2026-11-02",
      "title": "LICENSE (MIT)"
    }
  ],
  "confidence": "high",
  "depth": "standard",
  "deployment_models": [],
  "featured": false,
  "discovery_method": "editorial-research",
  "editorial_status": "reviewed",
  "visibility": "public",
  "author": "batch-F"
}
