Coder Social home page Coder Social logo

pharosabad / efficientfrontier.jl Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 249 KB

Entire Efficient Frontier by Status-Segment Method

License: MIT License

Julia 100.00%
critical-line-algorithm mean-variance-analysis efficient-portfolio entire-efficient-frontier

efficientfrontier.jl's Introduction

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.

efficientfrontier.jl's People

Contributors

pharosabad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

efficientfrontier.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.