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 Toolbox (MATLAB) Rmosek (R)

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

With a Google account, you can launch the notebook directly in Google CoLab by following the CoLab link.

Other resources


Try our Anaconda Package!

If you are using MOSEK from Python, we recommend the Anaconda distribution and the MOSEK Anaconda package.