Portfolio Optimization

MOSEK is employed extensively in the financial industry to solve optimization problems concerning Markowitz portfolio optimization and related problems. MOSEK is well known in the financial industry for its state-of-the-art optimizers for quadratic and conic problems. It is typically more cost-effective than canned software packages for portfolio optimization and provides more flexibility. On this page, we gather our publications and tutorials about portfolio optimization.

Tutorials in documentation

Portfolio optimization models can be conveniently implemented using the Fusion API (an object-oriented API available for C++, Java, .NET, and Python) but also using other with other APIs. Each API manual contains a comprehensive portfolio optimization tutorial with examples covering the Markowitz model, efficient frontier, transaction costs, buy-in thresholds, mean-variance optimization, and more. Direct links to these tutorials are available below:

Fusion API C++ Java .NET Python
Optimizer API C Java .NET Python Julia Rust
Other interfaces MATLAB (New) Rmosek (R) MATLAB (Old)

Portfolio Optimization Cookbook

The MOSEK Portfolio Optimization Cookbook provides an introduction to the topic of portfolio optimization and discusses several branches of practical interest from this broad subject. We intended it to be a practical guide, a cookbook, that not only serves as a reference but also supports the reader with practical implementation. We do not assume that the reader is acquainted with portfolio optimization. Thus the book can be used as a starting point, while for the experienced reader, it can serve as a review. First, we familiarize the reader with the basic concepts and the most relevant approaches in portfolio optimization. Then we also present computational examples with code to illustrate these concepts and provide a basis for implementing more complex and specific cases. We aim to keep the discussion concise and self-contained, covering only the main ideas and tools and the most important pitfalls from a theoretical and technical perspective. The reader is directed towards further reading in each subject through references.

MOSEK Portfolio Optimization Cookbook HTML PDF (A4) PDF (letter)

The Portfolio Optimization Cookbook is accompanied by a GitHub repository with code examples featured in the book.

Python notebooks (MOSEK Fusion API)

Notebook Problem type Keywords Links
Mean-variance optimization CQO Markowitz, efficient frontier, conic model, risk, return source, Cookbook
Preparing input data data transformation distribution estimation, projection to investment horizon source, Cookbook
Long-short dollar neutral optimization CQO long-short, dollar neutral, gross exposure source, Cookbook
Long-short dollar neutral optimization (fixed gross exposure) CQO, mixed-int long-short, dollar neutral, gross exposure source, Cookbook
Shrinkage CQO shrinkage, Ledoit--Wolf, James--Stein source, Cookbook
Single factor model CQO factor model source, Cookbook
Large scale factor model CQO factor model source, Cookbook
Market impact costs CQO, POW market impact, power law source, Cookbook
Transaction costs CQO, mixed-int leverage, buy-in threshold, fixed costs source, Cookbook
Benchmark relative optimization CQO active return, tracking error source, Cookbook
Fund of funds optimization CQO multiple funds and benchmarks, tracking error source, Cookbook
CVaR optimization LO CVaR, Monte Carlo scenarios source, Cookbook
EVaR optimization EXP EVaR, Monte Carlo scenarios source, Cookbook
Expected utility maximization CQO, EXP Expected utility, Gaussian mixture return source, Cookbook
Risk parity model CQO, EXP risk budgeting, risk contribution source, Cookbook
Risk parity model (long-short) CQO, EXP, mixed-int risk budgeting, risk contribution, long-short source, Cookbook
Robust mean-variance model CQO robust optimization, uncertainty set source, Cookbook
Robust MVO with factor model CQO robust optimization, uncertainty set, factor model source, Cookbook, Article
Multiperiod mean-variance model CQO, POW multiperiod, transaction cost, market impact source, Cookbook, Article
Regression and regularization CQO, POW regression, OLS, ridge, LASSO, transaction cost, market impact source, Cookbook

Other resources


Try our Remote Optimization Server!

The Optimization Server (OptServer) is a MOSEK service for executing optimization tasks on a remote machine, including job scheduling, user management and other features. See documentation for details.