$npx skillfedfor your agent

riskfolio-lib

Portfolio Optimization in Python

With conditionsPyPI MathematicsReleased May 2026104.2K downloads / moBSD (3-clause)Platform wheel

Decision gist · record as of 2026-08-14

platform wheels — riskfolio_lib-7.3.0-cp310-cp310-macosx_10_9_universal2.whl · riskfolio_lib-7.3.0-cp310-cp310-macosx_10_9_x86_64.whl · riskfolio_lib-7.3.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
v7.3.0 · released 2026-05-31 · Python >=3.10 · 15 runtime deps: numpy, scipy, pandas, matplotlib, clarabel, SCS, cvxpy, scikit-learn

Yes, if you need to solve real portfolio optimization problems beyond simple equal-weight or market-cap allocation. The library is actively maintained, has no known vulnerabilities, runs on modern Python versions, and offers a mature API covering academic and practitioner use cases. Install friction is moderate due to numerical dependencies, but prebuilt wheels are available. The permissive BSD license poses no compliance risk. Start with the tutorial if you are new to portfolio optimization.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python >=3.10; cvxpy and its solver dependencies (clarabel or SCS) must resolve successfully; large-scale problems may benefit from commercial solvers (MOSEK, GUROBI) configured separately.
  • Medium install friction: 15 runtime dependencies including numerical (numpy, scipy, pandas), optimization (cvxpy, clarabel, SCS), and statistical libraries (scikit-learn, statsmodels, arch).
  • Prebuilt wheels available for Python 3.10–3.14 on macOS, Linux, and Windows.

License · maintenance · safety

BSD (3-clause) (permissive) — BSD 3-clause permissive license allows commercial use, modification, and redistribution with minimal restrictions—suitable for both proprietary and open-source projects.

last release 2026-05-31 (75 days) · last repo commit 2026-06-22 · 4,441 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 104,228 downloads/mo, #12,760 on PyPI

Verify before relying

import pandas as pd
import riskfolio as rp

returns = pd.read_csv('returns.csv', index_col=0)
port = rp.Portfolio(returns=returns)
port.optimize('MinRisk')
weights = port.weights
  • Performance characteristics and scalability limits for portfolio sizes beyond typical institutional use.
  • Solver selection guidance and trade-offs between clarabel, SCS, and commercial alternatives for specific problem classes.
  • Numerical stability and convergence guarantees under extreme market conditions or edge-case covariance matrices.
Same gist for agents: .md · .json

What it is and what it does

Riskfolio-Lib is a portfolio optimization library built on CVXPY that lets you construct investment portfolios using mathematically rigorous models without deep solver expertise. It integrates directly with Pandas DataFrames and supports a large range of optimization objectives (minimum risk, maximum return, maximum Sharpe ratio, risk parity) combined with 26+ risk measures spanning dispersion, downside, and drawdown categories. You can apply constraints on leverage, turnover, cardinality, tracking error, and graph-based relationships between assets, and use advanced techniques like hierarchical risk parity, Black-Litterman views, risk factor models, and entropy pooling.

The library is designed for students, academics, and practitioners who need to move from theory to working portfolios quickly. It handles the convex optimization setup internally, letting you focus on portfolio design rather than solver configuration. It includes tools for building efficient frontiers, calculating risk contributions, estimating uncertainty sets, clustering assets by codependence, and generating reports in Jupyter or Excel. You can also plug in commercial solvers (MOSEK, GUROBI) for large-scale problems.

Use it for

  • Build mean-variance efficient frontiers and find optimal allocations for a given risk tolerance or return target.
  • Construct risk parity or equal-weight portfolios with constraints on maximum position size, leverage, or sector concentration.
  • Incorporate expert views or market factors into portfolio construction using Black-Litterman or risk factor models.
  • Optimize hierarchical or nested clustered portfolios to reduce estimation error and improve out-of-sample stability.
  • Backtest portfolio rebalancing strategies with turnover and cardinality constraints to manage transaction costs.
  • Calculate and visualize risk contributions per asset or risk factor to understand portfolio exposure.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need to solve real portfolio optimization problems beyond simple equal-weight or market-cap allocation.

The library is actively maintained, has no known vulnerabilities, runs on modern Python versions, and offers a mature API covering academic and practitioner use cases. Install friction is moderate due to numerical dependencies, but prebuilt wheels are available. The permissive BSD license poses no compliance risk. Start with the tutorial if you are new to portfolio optimization.

Install

riskfolio-lib on PyPI

Before you install

Medium install friction: 15 runtime dependencies including numerical (numpy, scipy, pandas), optimization (cvxpy, clarabel, SCS), and statistical libraries (scikit-learn, statsmodels, arch). Prebuilt wheels available for Python 3.10–3.14 on macOS, Linux, and Windows. Active maintenance with recent releases.

Requires Python >=3.10; cvxpy and its solver dependencies (clarabel or SCS) must resolve successfully; large-scale problems may benefit from commercial solvers (MOSEK, GUROBI) configured separately.

License in practice

BSD 3-clause permissive license allows commercial use, modification, and redistribution with minimal restrictions—suitable for both proprietary and open-source projects.

Quickstart

import pandas as pd
import riskfolio as rp

returns = pd.read_csv('returns.csv', index_col=0)
port = rp.Portfolio(returns=returns)
port.optimize('MinRisk')
weights = port.weights

Verify before relying

  • Performance characteristics and scalability limits for portfolio sizes beyond typical institutional use.
  • Solver selection guidance and trade-offs between clarabel, SCS, and commercial alternatives for specific problem classes.
  • Numerical stability and convergence guarantees under extreme market conditions or edge-case covariance matrices.

Package facts

LicenseBSD (3-clause) permissive
Python supportSupports the current Python release >=3.10
Install frictionMedium. Platform-specific wheel
Runtime dependencies
15 packages
numpyscipypandasmatplotlibclarabelSCScvxpyscikit-learnstatsmodelsarchxlsxwriternetworkxastropypybind11vectorbt
MaintenanceActively maintained 75 days since the last release
Last repo commit
First released
Downloads104,228 / month, #12,760 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Intended Audience :: Financial and Insurance IndustryIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: MacOSOperating System :: MicrosoftOperating System :: UnixProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Office/Business :: FinancialTopic :: Office/Business :: Financial :: InvestmentTopic :: Scientific/Engineering :: Mathematics

Evidence: riskfolio_lib-7.3.0-cp310-cp310-macosx_10_9_universal2.whl; riskfolio_lib-7.3.0-cp310-cp310-macosx_10_9_x86_64.whl; riskfolio_lib-7.3.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; riskfolio_lib-7.3.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; riskfolio_lib-7.3.0-cp310-cp310-win_amd64.whl; riskfolio_lib-7.3.0-cp311-cp311-macosx_10_9_universal2.whl; riskfolio_lib-7.3.0-cp311-cp311-macosx_10_9_x86_64.whl; riskfolio_lib-7.3.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; riskfolio_lib-7.3.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; riskfolio_lib-7.3.0-cp311-cp311-win_amd64.whl; riskfolio_lib-7.3.0-cp312-cp312-macosx_10_13_universal2.whl; riskfolio_lib-7.3.0-cp312-cp312-macosx_10_13_x86_64.whl; riskfolio_lib-7.3.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; riskfolio_lib-7.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; riskfolio_lib-7.3.0-cp312-cp312-win_amd64.whl; riskfolio_lib-7.3.0-cp313-cp313-macosx_10_13_universal2.whl; riskfolio_lib-7.3.0-cp313-cp313-macosx_10_13_x86_64.whl; riskfolio_lib-7.3.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; riskfolio_lib-7.3.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; riskfolio_lib-7.3.0-cp313-cp313-win_amd64.whl

Tags

Capabilities
portfolio optimization pythonmean variance optimizationrisk parity allocationefficient frontier calculationasset allocation librarycvxpy portfolio solverhierarchical risk parityportfolio rebalancing constraints
Topics
portfolio-optimizationquantitative-financeconvex-optimization
PyPI keywords
financeportfoliooptimizationquantasset allocationinvesting

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “mean variance optimization”

  • riskfolio-libRiskfolio-Lib builds optimized investment portfolios using…
  • statisticsProvides basic mathematical statistics functions (mean, median, mode,…
  • runstatsComputes summary statistics (mean, variance, standard deviation,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Mathematics packages

networkx Worth it
PyPI · Python Modules · released Dec 2025

NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.

BSD-3-Clausepure Python
290.9Mdownloads / mo
kiwisolver Worth it
PyPI · Mathematics · released Mar 2026

kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.

Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.

BSD-3-Clausecompiled wheel · 3.10+
205.5Mdownloads / mo
sympy Worth it
PyPI · Scientific/Engineering · released Apr 2025

SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.

BSD-3-Clausepure Python · 3.9+
196.4Mdownloads / mo
contourpy Worth it
PyPI · Information Analysis · released Jul 2025

ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.

BSD-3-Clausecompiled wheel · 3.11+
191.2Mdownloads / mo
torch With conditions
PyPI · Software Development · released Jul 2026

PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.

Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND MITcompiled wheel · 3.10+
102.5Mdownloads / mo
onnxruntime Worth it
PyPI · Software Development · released Jul 2026

onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.

Install it if you have ONNX models to run in production or development.

MITcompiled wheel · 3.11+
89.3Mdownloads / mo

See also pyportfolioopt · skfolio · empyrical-reloaded · quantstats · QuantLib · cvxpy · numpy-financial · PuLP · optlang · vectorbt