Quant Sandbox
DerivativesPortfolio & RiskFixed IncomeCorporate FinanceStochastic ModelsGuide
Portfolio & Risk
Risk & ReturnBeta
CAPMBeta
Portfolio LabBeta
Portfolio OptimizationBeta
Connected Guides
  • The efficient frontier and the capital market line
  • Diversification and correlation
  • CAPM, beta and the security market line

© 2026 Quant Sandbox · A study aid for quantitative finance

Privacy & dataNo cookies

This site does not use cookies and asks for no personal data. It keeps a few small settings in your browser's local storage — your chosen theme and language, the sidebar layout, and your progress and answers in the Guides — so it remembers them on your next visit. This data never leaves your device; clearing your browser storage removes it. Inputs you change can also be captured in the page URL, so you can share or bookmark a specific setup. The site uses Vercel Web Analytics, a privacy-friendly, cookieless service that records only anonymous, aggregated usage (such as page views) without identifying you or tracking you across other sites.

Portfolio Optimization

A Markowitz optimizer: objective, constraints, the efficient frontier and the cost of constraints on the same portfolio model.

Optimization problem

Objective
Constraints
Long only
Allow short selling
%
%
Risk-free asset
Risk-free asset
Optimization geometry
Feasible setUnconstrained frontierConstrained frontierAssetsSelected

Hover the frontier or the composition to preview a portfolio; click or drag to pin the selection. In target-return / target-volatility mode, drag the target line.

Frontier composition
Selected optimal portfolio
Expected return6.0%
Volatility7.9%
Sharpe0.38
ObjectiveMin variance
Unconstrained → Constrained7.9% → 7.9% +0.0% volatility

Portfolio composition

  • TLT74.3%
  • GOOGL14.7%
  • AAPL5.9%
  • MSFT5.2%
  • AMZN0.0%

About this tool

Markowitz portfolio optimization finds the portfolios with the highest expected return for each level of risk: the efficient frontier. This tool solves for the global minimum-variance portfolio, the maximum-Sharpe tangency portfolio and portfolios with a target return or volatility, and shows how weight constraints such as no short selling cost efficiency.

Frequently asked questions

What is the tangency portfolio?

The frontier portfolio with the highest Sharpe ratio. The line from the risk-free rate to it is the steepest possible capital allocation line.

Why do constraints matter?

Limits such as no short selling shrink the set of allowed portfolios, so the constrained frontier lies on or below the unconstrained one. The gap is the cost of the constraint.