Variance
The classical measure: minimise how wildly your portfolio value bounces around under the chosen precision matrix. Closed-form, instantaneous, well understood.
Closed form · O(n³)
Convexfolio takes your prices, expected payoffs, and a risk model — and returns the exact budget split that minimises your risk. Deterministic, reproducible, and built on the closed-form math of arXiv:2601.07991.
$ convexfolio --command print-report
{
"method": "variance",
"weights": { "A": 0.4200, "B": 0.5800 },
"cost_check": 1.0000,
"deterministic": true
}
Three first-class solvers, each tuned for a different definition of "risk". Pick the one that matches the math you're trying to do — or let Convexfolio compare all of them in one run.
The classical measure: minimise how wildly your portfolio value bounces around under the chosen precision matrix. Closed-form, instantaneous, well understood.
Closed form · O(n³)
A sharper, faster risk measure with an exact formula — no iteration, no approximation. Drop-in for the variance minimiser when you want a tighter tail.
Closed form · exact
The most accurate measure in the family. Solved numerically with SciPy's SLSQP under the same deterministic guarantees as the closed-form solvers.
Numerical · SLSQP
A tiny, well-typed Python surface. Point Convexfolio at your prices, expected payoffs, and a precision matrix — then choose a risk measure. The optimiser returns the exact budget split that minimises risk.
Prices, expected payoffs, and a precision matrix — JSON, YAML, or straight from Python. No proprietary schemas.
Variance, CFVaR₂, or CFVaR₃ — or run all three and pick the best fit. Convexfolio returns weights that minimise the chosen measure exactly.
Every run is byte-identical to the previous one. Spot-check the report, then plug the same primitive into backtests and constraints.
import numpy as np
from convexfolio import Variance, Minimize
# Two options · $0.60 and $0.40 · precision matrix below.
precision = np.array([[2.0, 0.1],
[0.1, 1.5]])
costs = np.array([0.60, 0.40])
# Find the lowest-risk budget split.
weights = Minimize(Variance(precision), costs).value
print(weights) # → [1.0591, 0.9113]
[1.0591133 0.91133005]
A small, focused API. Every feature is documented, tested, and verified against the math.
Same inputs always give byte-identical outputs. A built-in determinism check makes it auditable, not just claimed.
Run reports in a single command — convexfolio --command print-report. No Python required for the common path.
Describe constraints and settings in a plain text file. Keep your experiments reproducible without code check-ins.
Implements the closed-form results of arXiv:2601.07991 with a published fidelity report.
Variance, CFVaR₂, CFVaR₃, Minimize, Backtest, Constraints. Import a primitive, get a result — no ceremony.
Multi-period rebalancing with transaction costs. Sector caps, position limits, and leverage bounds when you need them.
Convexfolio is MIT-licensed research software. No paid tiers, no telemetry, no signup. Install it once and it stays yours.
Read the research, study the implementation, fork it, ship it. Always verify outputs against independent models and current market data — Convexfolio's outputs are illustrative, not investment advice.
$ pip install convexfolio
Successfully installed convexfolio-1.0.0
$ docker run --rm ghcr.io/sachncs/convexfolio \
--command print-report
{ "method": "variance", … }
$ git clone https://github.com/sachncs/convexfolio
cd convexfolio
python3 -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
Ready to develop.
Install Convexfolio, point it at a portfolio, and read the report. Fifteen minutes from pip install to a solved split.