Skip to content

PharosAbad/EfficientFrontier.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EfficientFrontier.jl

Build Status Stable

Entire Efficient Frontier by Status-Segment Method

FeaturesInstallationLicenseDocumentation

EfficientFrontier.jl solves the following problem:

$$ \begin{array} [c]{cl} \min & \frac{1}{2}\mathbf{z}^{\prime}\mathbf{Vz}-L\mathbf{z}^{\prime }\boldsymbol{\mu}\\ s.t. & \mathbf{Az}=\mathbf{b}\in\mathbb{R}^{M}\\ & \mathbf{Gz}\leq\mathbf{g}\in\mathbb{R}^{J}\\ & \boldsymbol{d}\leq\mathbf{z}\leq\boldsymbol{u}\in\mathbb{R}^{N} \end{array} $$

with mean vector $\boldsymbol{\mu}\in\mathbb{R}^{N}$ and variance matrix $\mathbf{V}\in\mathbb{R}^{N\times N}$. $\textcolor{blue}{ Varying\ L\ from\ +\infty\ to\ 0}$, all the efficient critical line segments are computed using closed-form formulas. And the full Efficient Frontier is recorded by corner portfolios connected by parabolas with analytical parameter.

I can't wait to see: A Quick Example

The Status-Segment Method is a two-stage method:

  1. find out the status of each asset, that is, whether the weight of the asset falls on the upper or lower bounds of the interval (OUT: DN or UP), or in the middle of the interval (IN).
  2. find out the efficient segment of the CL (critical line), that is, the value range of the slope $L$ in the EV plane.

Since the end points of the efficient segment of a CL provide the status information for the adjacent CLs, the efficient segment of an adjacent CL is found immediately. Therefore, as long as the status of any point on the efficient frontier is found, the entire efficient frontier can be found (one and all).

Features

  • Entire efficient frontier: calculate the entire efficient frontier, not just a single frontier portfolio
  • Analytical solutions: use analytical solutions for calculations, not a numerical method that iterate to convergence (A working paper is coming soon).
  • Faster: Even for a single frontier portfolio, our solution is faster and more accurate than the latest numerical methods such as Clarabel, because we calculate through the analytical solution, rather than through numerical iteration to convergence.
  • Versatile: from the simplest no short-sale to most general model with lower and upper bounds, inequality constraints, and equality constraints. Theoretically we require the variance matrix to be symmetric and positive definite, but in fact we only need the variance matrix subblocks of the IN set to be symmetric and positive definite. Please refer to SP500 for a rank-deficient example
  • All-weather: The Critical Line Algorithm (CLA) (Markowitz, 1956; Markowitz and Todd, 2000) requires the model to be non-degenerate (there is only one asset toggling IN and OUT state). Or the perturbation method is used to solve the degenerated cases. Our calculations do not suffer from these problems, and we find an example of incorrect results obtained by CLA's perturbation algorithm
  • Plugin: Simplex method and Combinatorial search method are built-in methods to identify the Status for first CL. An example of plugin using Clarabel is provided, which finds the Status with the highest $L$ value to start the calculation.
  • Open Source: Our code is available on GitHub and distributed under the MIT License
  • Arbitrary Precision Arithmetic: fully support for BigFloat from v0.2.0

Installation

EfficientFrontier.jl can be added by

  • import Pkg; Pkg.add("EfficientFrontier")
  • pkg> add EfficientFrontier
  • pkg> dev EfficientFrontier for testing nightly version. To use the registered version again pkg> free EfficientFrontier

License 🔍

This project is licensed under the MIT License - see the LICENSE file for details.