Skip to main content

pyportopt

Portfolio optimization: minimum variance, maximum return under a volatility cap, maximum Sharpe ratio, mean-variance utility, importance, Kelly, tracking error, maximum diversification and risk parity, with box bounds, a gross exposure limit, cash and the multipliers of every constraint. The numerical core is the PortOpt C++23 library, which this package bundles and calls through its C API.

pip install pyportopt
import numpy as np
import portopt as po

mu = np.array([0.05, 0.08, 0.11])
cov = np.array([[0.04, 0.006, 0.002], [0.006, 0.09, 0.012], [0.002, 0.012, 0.16]])
data = po.Data(mu, cov)
result = po.solve(po.Spec(po.Objective.MIN_VARIANCE, bounds=(0.0, 1.0)), data)
print(result.status.name, result.weights)      # OPTIMAL [0.6234 0.2356 0.141 ] (rounded)

The distribution is pyportopt; the module is portopt. Python 3.11 or newer, with numpy. Until 1.0 the API may change between minor versions. Documentation, the C and C++ interfaces and the changelog: https://github.com/GabrielMarquezMatte/PortfolioOptimization

Metadata

Release files for pyportopt 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyportopt 1.0.0
File Actions
pyportopt-1.0.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for pyportopt-1.0.0-py3-none-win_amd64.whl
pyportopt-1.0.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for pyportopt-1.0.0-py3-none-musllinux_1_2_x86_64.whl
pyportopt-1.0.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for pyportopt-1.0.0-py3-none-musllinux_1_2_aarch64.whl
pyportopt-1.0.0-py3-none-manylinux_2_25_x86_64.whl Python 3 none Linux glibc 2.25+ x86-64 Details for pyportopt-1.0.0-py3-none-manylinux_2_25_x86_64.whl
pyportopt-1.0.0-py3-none-manylinux_2_25_aarch64.whl Python 3 none Linux glibc 2.25+ ARM64 Details for pyportopt-1.0.0-py3-none-manylinux_2_25_aarch64.whl
pyportopt-1.0.0-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details for pyportopt-1.0.0-py3-none-macosx_11_0_x86_64.whl
pyportopt-1.0.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for pyportopt-1.0.0-py3-none-macosx_11_0_arm64.whl

Total release size: 1.9 MB

Release files / pyportopt-1.0.0-py3-none-win_amd64.whl

Download URL pyportopt-1.0.0-py3-none-win_amd64.whl
Size 331.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
97029e1dd2ed3fea024adbc0793a232b374f3fb2146a4dea66b77c9fa085fccb
BLAKE2b-256 checksum
How to use checksums
29de79a53d4cbe0ba9aafd35d9f75042f4a63189d733d05e71eb4e924c78edfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyportopt-1.0.0-py3-none-musllinux_1_2_x86_64.whl

Download URL pyportopt-1.0.0-py3-none-musllinux_1_2_x86_64.whl
Size 374.4 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
19b0378114cdd5b99bc0c43fe05181d7d0b0815e1f2b25c65ef55040e48670e8
BLAKE2b-256 checksum
How to use checksums
78420fe42c0429a892035f97e595d05524e63f2e6b8c2a76e86529ed8bd22244
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyportopt-1.0.0-py3-none-musllinux_1_2_aarch64.whl

Download URL pyportopt-1.0.0-py3-none-musllinux_1_2_aarch64.whl
Size 344.9 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
08526e821b1f08daeda8f82918f8f71d9df361252c6bedfe1e8d9c47c7819b29
BLAKE2b-256 checksum
How to use checksums
a319b33691b9273a975925e67f174a98c8694aa6ad39457b2d5da69452a817df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyportopt-1.0.0-py3-none-manylinux_2_25_x86_64.whl

Download URL pyportopt-1.0.0-py3-none-manylinux_2_25_x86_64.whl
Size 296.3 kB
Tags Linux glibc 2.25+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e6c78678188b2edc2369ed0d87f4f3f468f91ba7740f858b1ac774173e1fa78c
BLAKE2b-256 checksum
How to use checksums
dda30cb335e5224a3b50c2a9a262dc7f4ed53b64e763ff14520af0533ec76016
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyportopt-1.0.0-py3-none-manylinux_2_25_aarch64.whl

Download URL pyportopt-1.0.0-py3-none-manylinux_2_25_aarch64.whl
Size 267.1 kB
Tags Linux glibc 2.25+ ARM64 Python 3
SHA-256 checksum
How to use checksums
2a4ae6300aac89d5313d002047c2c0a1939ce7943220f4eb93f3f3e99a13372e
BLAKE2b-256 checksum
How to use checksums
f28da599468b0d20747dfbe8c05b44e7f26b716f22d693864827f3abb882a387
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyportopt-1.0.0-py3-none-macosx_11_0_x86_64.whl

Download URL pyportopt-1.0.0-py3-none-macosx_11_0_x86_64.whl
Size 149.9 kB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
ed208f0fa35a9c31cd7efbf16369efd8312b6cfa79971b3bff9d904fd6da7df9
BLAKE2b-256 checksum
How to use checksums
54b47a084ef20cff78faecf904c3dc788efec95ba796e7949d37b8477a72b544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyportopt-1.0.0-py3-none-macosx_11_0_arm64.whl

Download URL pyportopt-1.0.0-py3-none-macosx_11_0_arm64.whl
Size 130.3 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d8e12c823ed6a07b29ab7a6054cc74ecdde4c7fdc5ba2e52f292068ef1d1630b
BLAKE2b-256 checksum
How to use checksums
c43986bf622d291b03d4da988c9123acd0bc606ddf3279e14930b83977d677ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pyportopt 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page