Portfolio Optimization via VQE
PyPI: https://pypi.org/project/vqe-portfolio/
Website: https://sidrichardsquantum.github.io/VQE_Portfolio_Optimization/
A Python library for portfolio optimization with PennyLane. It provides Binary VQE and QAOA for selecting a fixed number of assets, and Fractional VQE for long-only allocation. Classical baselines and independent candidate evaluation support reproducible comparisons.
The experiments use quantum simulation and do not establish quantum advantage or production readiness.
Installation
pip install vqe-portfolio
Optional dependencies:
pip install "vqe-portfolio[data]" # Market data utilities
pip install "vqe-portfolio[classical]" # SciPy/HiGHS and CVXPY/OSQP baselines
pip install -e ".[dev,docs]" # Development and documentation
Quickstart
Run a small synthetic asset-selection problem:
import numpy as np
from vqe_portfolio import BinaryVQEConfig, run_binary_vqe
mu = np.array([0.10, 0.12, 0.07, 0.09])
sigma = np.eye(4) * 0.02
config = BinaryVQEConfig(k=2, lam=4.0, alpha=2.0, steps=25, seed=0)
result = run_binary_vqe(mu, sigma, config)
print(result.x_topk)
The command-line interface supports the same solvers:
vqe-portfolio --help
python -m vqe_portfolio --help
See the usage guide for complete API and CLI examples, ansatz options, real-data workflows, and efficient frontiers.
Repository structure
src/vqe_portfolio/
├── binary.py, qaoa.py, fractional.py # Quantum solvers
├── problem.py, types.py # Problem evaluation and solver types
├── ansatz.py, optimize.py # Shared circuit and optimizer code
├── baselines/ # Classical references and optional solvers
├── benchmark.py # Independent candidate evaluation/reporting
├── research/ # Study logic and shared runner infrastructure
└── ... # CLI, data, plotting, frontier utilities
scripts/ # Experiment entry points and report generation
experiments/ # Study configuration and reproduction guide
results/ # Saved research evidence
notebooks/ # Tutorial and comparison clients
tests/ # Solver, research, CLI, compatibility tests
docs/ # Sphinx documentation
See architecture and development for module boundaries and the v0.3.0 migration notes. Existing public imports remain supported.
Documentation and research
| Guide | Contents |
|---|---|
| Usage | Installation, API, CLI, benchmarks, and reproduction commands |
| Theory | Portfolio formulations, circuit mappings, and derivations |
| Results | Committed benchmark and diagnostic findings |
| Research protocol | Evaluation design and limits on advantage claims |
| Experiments | Validation, training, sampling, and failure diagnostics |
Start with notebooks/Binary.ipynb, notebooks/QAOA.ipynb, or notebooks/Fractional.ipynb. Real-data examples are in notebooks/examples/.
Saved study reports:
- Small-instance validation
- Before/after training
- Sampling allowances
- Training effort
- Failure diagnostics
Author and support
Sid Richards · LinkedIn · Sponsor development
MIT License — see LICENSE.
Metadata
Release files for vqe-portfolio 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vqe_portfolio-0.3.0.tar.gz | 70.0 kB | With provenance | Details for vqe_portfolio-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vqe_portfolio-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for vqe_portfolio-0.3.0-py3-none-any.whl |
Total release size: 130.4 kB
Release files / vqe_portfolio-0.3.0.tar.gz
| Download URL | vqe_portfolio-0.3.0.tar.gz |
|---|---|
| Size | 70.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d904c9c83ee34fb8dc83c4aa85bcf00080a239f735435ef87c50d21296eeb0f
|
|
BLAKE2b-256 checksum How to use checksums |
d3defb2e95fec8d595a6c57636b8c9372944abf130b97151918cc031607ba469
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / vqe_portfolio-0.3.0-py3-none-any.whl
| Download URL | vqe_portfolio-0.3.0-py3-none-any.whl |
|---|---|
| Size | 60.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9185d9fcad325400ee0acc5fa81d7bd01887b424f311eaca22d39baf01771292
|
|
BLAKE2b-256 checksum How to use checksums |
d855c3a0f4b17ad56f081cf5527f963045a24f62194c55ad057039a1cabbd5e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for vqe-portfolio 0.3.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for vqe_portfolio-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA 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.