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:
|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.
The Portfolio Optimization Cookbook is accompanied by a GitHub repository with code examples featured in the book.
Python notebooks (MOSEK Fusion API)
|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, Article|
With a Google account, you can launch the notebook directly in Google CoLab by following the CoLab link.
- A note on formulating quadratic functions. In some cases, simple tricks can reduce solution time by a factor of 10 or more.
- The MOSEK Modeling Cookbook - is a mathematically oriented publication about conic optimization which presents the theory, examples, and many tips and tricks about formulating optimization problems. Also available as PDF (A4) and PDF (letter).
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.