# cvxgrp/cvxportfolio

Portfolio optimization and back-testing.

Repository: https://github.com/cvxgrp/cvxportfolio
Canonical: https://ross.abutalabs.com/products/cvxportfolio
Homepage: https://www.cvxportfolio.com
Language: Python
License: GPL-3.0
License Family: copyleft
Topics: convex-optimization, finance, optimization, optimization-algorithms, optimization-methods, optimizer, portfolio-optimization, python, time-series
Last push: 2026-04-27T14:11:17+00:00

## Health v2 (maintenance only)
Score: 58/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 79, release rhythm 8, longevity 100
- inputs: {"age_days": 3522, "days_push": 128, "days_rel": 423, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1253, forks 292 (observed 2026-08-28T04:04:08.523250+00:00)

## What it is
Cvxportfolio is an object-oriented Python library for portfolio optimization and back-testing, implementing the convex-optimization trading models from the Stanford/BlackRock paper. It provides a market simulator, symbolic optimization-based trading policies, cost and risk models, and forecasters, built on CVXPY and Pandas.

## Use cases
- backtest a portfolio optimization strategy in Python
- build a Markowitz mean-variance asset allocation policy
- simulate trading strategy performance including transaction and holding costs
- optimize asset allocation with long-only, leverage, or factor-neutral constraints
- research quantitative trading strategies on historical market data
- compare multiple trading policies with a market simulator
- define custom return forecasts and covariance risk models for trading policies

## When to choose
- You want convex-optimization-based portfolio construction and back-testing in a Python library
- You prefer symbolic trading policies (objectives plus constraints) that work with any asset universe and Pandas time-series data
- You want a realistic market simulator with stock-specific transaction and holding cost defaults
- You plan to extend the framework with custom costs, constraints, or forecast models

## When to avoid
- You need live order execution or broker connectivity - the library computes target weights and simulates rather than trading in production
- You need machine-learning or combinatorial (non-convex) portfolio optimization outside the CVXPY convex framework
- You need tick-level or high-frequency market microstructure simulation
- The GPL-3.0 license is incompatible with your project's licensing

## Facets
- artifact type: library
- maturity: active
- function: trading, simulation, math, data-science
- domain: fintech, time-series, data-science, mathematics
- platform: python, cross-platform
- tags: convex-optimization, portfolio-optimization, backtesting, quantitative-finance, markowitz, cvxpy, market-simulator, trading-strategies, risk-models, transaction-costs

## Member repositories
- cvxgrp/cvxportfolio (main) score 58

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:08.523250+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:07:28.228912+00:00, confidence not recorded.
  - readme: https://github.com/cvxgrp/cvxportfolio (fetched 2026-08-28T04:04:08.523250+00:00, sha 57f1375701b2)
  - homepage: https://www.cvxportfolio.com (fetched 2026-08-29T12:18:17.007508+00:00, sha 0a20ccecb8f1)
  - registry_pypi: https://pypi.org/pypi/cvxportfolio/json (fetched 2026-08-29T12:18:17.025482+00:00, sha a5a86b5d0bd7)
  - site_page: https://www.cvxportfolio.com/en/1.5.0/api.html (fetched 2026-08-29T12:18:17.016901+00:00, sha 7fea9dba7b38)
  - site_page: https://www.cvxportfolio.com/en/1.5.0/manual.html (fetched 2026-08-29T12:18:17.018900+00:00, sha bd7b0276e1bb)
  - site_page: https://www.cvxportfolio.com/en/1.5.0/costs.html (fetched 2026-08-29T12:18:17.021641+00:00, sha 6d60c600915d)
  - site_page: https://www.cvxportfolio.com/en/1.5.0/forecasts.html (fetched 2026-08-29T12:18:17.023589+00:00, sha d84b32ec9267)
- Data as of 2026-08-30T08:39:29.467469+00:00.
