Max Sharpe = (Rp - Rf) / Sigma_p
The optimizer iterates through all stock/bond weight combinations to find the allocation that maximizes the Sharpe ratio -- the excess return per unit of risk.
Portfolio optimization is the process of selecting the best asset allocation from a set of possible portfolios to achieve the highest risk-adjusted return. Modern Portfolio Theory (MPT), developed by Harry Markowitz in 1952, provides the mathematical framework for this process, demonstrating that an optimal portfolio can reduce risk through diversification without sacrificing expected returns.
The key insight of MPT is that the risk of an individual asset matters less than how that asset contributes to the overall portfolio risk. By combining assets with low or negative correlations, investors can construct portfolios that lie on the "efficient frontier" -- the set of portfolios offering the maximum expected return for each level of risk.
This calculator uses a brute-force approach to find the optimal two-asset portfolio. It evaluates every possible stock/bond weight combination in 1% increments and computes the portfolio return, risk (standard deviation), and Sharpe ratio for each. The allocation with the highest Sharpe ratio is selected as optimal, meaning it provides the best excess return per unit of risk taken.
The portfolio risk accounts for the correlation between assets. When correlation is low or negative, diversification benefits increase, potentially allowing a portfolio with lower risk than either individual asset. The risk-free rate serves as the benchmark -- returns above this rate represent the premium earned for taking investment risk.
This optimizer uses a simplified two-asset model with static inputs. In practice, expected returns, volatilities, and correlations change over time and are difficult to estimate accurately. Small changes in these inputs can lead to significantly different optimal allocations, a problem known as "estimation error sensitivity."
Real-world portfolios typically include multiple asset classes (domestic stocks, international stocks, bonds, real estate, commodities) and must account for transaction costs, taxes, liquidity constraints, and investor-specific factors like time horizon and risk tolerance. This calculator provides a useful starting framework, but comprehensive portfolio optimization should involve professional financial advice.