Skip to main content

Portfolio Optimization via VQE

PyPI Version Python Versions Tests License Sponsor

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. Version 0.3.1 adds opt-in solver reliability controls and end-to-end execution budgets; see the usage guide and changelog.

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:

Author and support

Sid Richards · LinkedIn · Sponsor development

MIT License — see LICENSE.

Metadata

Release files for vqe-portfolio 0.3.1

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

Source distribution (sdist)

Source distribution for vqe-portfolio 0.3.1
File Size Uploaded Provenance Actions
vqe_portfolio-0.3.1.tar.gz 81.9 kB With provenance Details for vqe_portfolio-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vqe-portfolio 0.3.1
File Interpreter ABI Platform Actions
vqe_portfolio-0.3.1-py3-none-any.whl Python 3 none any Details for vqe_portfolio-0.3.1-py3-none-any.whl

Total release size: 153.0 kB

Release files / vqe_portfolio-0.3.1.tar.gz

Download URL vqe_portfolio-0.3.1.tar.gz
Size 81.9 kB
Tags Source
SHA-256 checksum
How to use checksums
25b8c0ea0093a7d9344234ec62b2f1734e5609c390e1c70b25858d1aff2e5773
BLAKE2b-256 checksum
How to use checksums
c52084add9407007e10ebcb1acccf6231a1717ec473467fd337ff4352a2d3b9d
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 log

Release files / vqe_portfolio-0.3.1-py3-none-any.whl

Download URL vqe_portfolio-0.3.1-py3-none-any.whl
Size 71.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19d34623f16353f7b7a5b472918a70b03250e3ca4272ce10ee2275836eb304b3
BLAKE2b-256 checksum
How to use checksums
9682cfb3b568050ab992d367d61acb1c2437439a004988440c2e987bc0e40118
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 log

Security for vqe-portfolio 0.3.1

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.

Select from 2 files

Attestation for vqe_portfolio-0.3.1.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 log

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