ARBIMETRA · Financial intelligence, made practical.

ARBIMETRA LAB

Portfolio Optimization

Finds minimum-variance, global minimum-variance and maximum-Sharpe portfolios under long-only and weight constraints, and verifies convergence.

What it does

Finds minimum-variance, global minimum-variance and maximum-Sharpe portfolios under long-only and weight constraints, and verifies convergence.

Use it to explore mean-variance trade-offs.

Data you need

  • Two or more return or price columns

Optional: Target return, weight limits

Supported data: Numeric. Level: Advanced.

Formula and method

min w′Σw subject to Σw = 1, l ≤ w ≤ u

A sequential quadratic programming solver minimises w′Σw, or maximises the Sharpe ratio from several starting points, under full-investment and weight constraints. A result is shown only if the solver reports convergence.

Assumptions

  • Returns are described by means and covariances

Input checks

  • Limits must allow weights to sum to 1
  • Singular covariance is rejected
  • Convergence is required

How to read the result

Treat weights as sensitive to inputs.

Worked example

Illustrative run on Simulated weekly returns (teaching data, not market data). These figures are the actual output of this model on that example, and they say nothing about your own data.

  • Maximum Sharpe ratio = 1.6371 a year. Global minimum variance has annual volatility 0.118.
  • These weights are best for the sample inputs, not for the future.

Limitations

  • Educational use, not investment advice
  • Sample means are noisy

Numerical validation

Validated 20 of 20 automated checks passed, including numerical results, invalid input, missing values, small samples, constant variables, charts and the interpretation text.

CheckReferenceResultAbs. errorToleranceSource
GMV weight a against closed form0.302446370.302446372.8e-161e-4Closed-form solution
Tangency weight a against closed form1.282618241.282618186.7e-82e-3Closed-form solution
GMV weight b against closed form0.054245760.054245765.2e-161e-4Closed-form solution
Tangency weight b against closed form0.468221450.468221413.4e-82e-3Closed-form solution
GMV weight c against closed form0.643307870.643307876.7e-161e-4Closed-form solution
Tangency weight c against closed form-0.75083969-0.750839591.0e-72e-3Closed-form solution

Computed with python 3.13.2, numpy 2.2.5, scipy 1.14.1, pandas 2.3.3, statsmodels 0.14.4, scikit-learn 1.7.0, in your browser. A passing check confirms the listed comparison only. It does not make any result suitable for your data, and it is not a claim of equivalence with other statistical software.

Questions

Why are my optimal weights so extreme?

Small errors in expected returns can move the solution a lot. Weight limits help.

ARBIMETRA LAB is an educational and research tool. Results should be checked by the researcher and are not professional advice.