Mean-Variance Optimizer

Mean-Variance Optimizer

Load price history from FYERS, estimate returns and covariance, then find the portfolio that fits your objective and limits.

Efficient frontier

Frontier Capital allocation line Assets Min variance Max Sharpe Selected

Allocation

Correlation

-1+1

How the numbers are built

Returns. Simple period returns from adjusted close, so dividends and splits are included. The mean is multiplied by the periods per year (252, 52 or 12).

Covariance. Sample covariance of the same returns, scaled the same way. Ledoit-Wolf pulls it toward a scaled identity matrix, which steadies the weights when history is short.

Optimizer. Quadratic program with a full-investment constraint and per-asset weight bounds. Maximum Sharpe is found by searching along the frontier.

Caution. Weights are very sensitive to expected-return estimates. Treat output as an input to judgment, not advice.