Portfolio Optimization

MOSEK is employed extensively in the financial industry to solve optimization problems arsing in connection with 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 and is typically more cost effective than canned software packages aimed at portfolio optimization and provides more flexibility. On this page we gather our publications and tutorials about portfolio optimization.

Tutorials in documentation

Portfolio optimization models are most conveniently implemented using the Fusion API - an object oriented API available for C++, Java, .NET and Python - and can as well be expressed in all the 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
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 to provide a basis for implementing more complex and more specific cases. We aim to keep the discussion concise and self-contained, covering only the main ideas and tools, the most important pitfalls, both from theoretical and from 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
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, error tracking 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.