MyNixOS website logo
Description

Design of Risk Parity Portfolios.

Fast design of risk parity portfolios for financial investment. The goal of the risk parity portfolio formulation is to equalize or distribute the risk contributions of the different assets, which is missing if we simply consider the overall volatility of the portfolio as in the mean-variance Markowitz portfolio. In addition to the vanilla formulation, where the risk contributions are perfectly equalized subject to no shortselling and budget constraints, many other formulations are considered that allow for box constraints and shortselling, as well as the inclusion of additional objectives like the expected return and overall variance. See vignette for a detailed documentation and comparison, with several illustrative examples. The package is based on the papers: Y. Feng, and D. P. Palomar (2015). SCRIP: Successive Convex Optimization Methods for Risk Parity Portfolio Design. IEEE Trans. on Signal Processing, vol. 63, no. 19, pp. 5285-5300. <doi:10.1109/TSP.2015.2452219>. F. Spinu (2013), An Algorithm for Computing Risk Parity Weights. <doi:10.2139/ssrn.2297383>. T. Griveau-Billion, J. Richard, and T. Roncalli (2013). A fast algorithm for computing High-dimensional risk parity portfolios. <arXiv:1311.4057>.

riskParityPortfolio

CRAN_Status_Badge CRAN Downloads CRAN Downloads Total Rcpp

codecov Travis (.org) branch Build status CircleCI Docker Build Status Build Status

riskParityPortfolio provides tools to design risk parity portfolios. In its simplest form, we consider the convex formulation with a unique solution proposed by Spinu (2013) and use a cyclical method inspired by Griveau-Billion (2013). For more general formulations, which are usually nonconvex, we implement the successive convex approximation method proposed by Feng & Palomar (2015).

The latest stable version of riskParityPortfolio is available at https://CRAN.R-project.org/package=riskParityPortfolio.

The latest development version of riskParityPortfolio is available at https://github.com/dppalomar/riskParityPortfolio.

Check out the documentation here: https://mirca.github.io/riskParityPortfolio.

Installation

To install the latest stable version of riskParityPortfolio from CRAN, run the following commands in R:

> install.packages("riskParityPortfolio")

To install the development version of riskParityPortfolio from GitHub, run the following commands in R:

> install.packages("devtools")
> devtools::install_github("dppalomar/riskParityPortfolio")

To get help:

> library(riskParityPortfolio)
> help(package = "riskParityPortfolio")
> package?riskParityPortfolio
> ?riskParityPortfolio

Please cite riskParityPortfolio in publications:

> citation("riskParityPortfolio")

You can also get riskParityPortfolio from Docker as follows:

$ docker pull mirca/riskparityportfolio

Microsoft Windows

On MS Windows environments, make sure to install the most recent version of Rtools.

Python

A Python3 implementation of this package is currently under development at https://github.com/dppalomar/riskparity.py. Its stable version is available in PYPI and can be installed as follows:

$ pip install riskparityportfolio

Alternatively, the development version can be installed as

$ git clone https://github.com/dppalomar/riskparity.py
$ cd python
$ pip install -e .

Basic usage

library(riskParityPortfolio)

set.seed(42)
# create covariance matrix
N <- 5
V <- matrix(rnorm(N^2), ncol = N)
Sigma <- cov(V)

# risk parity portfolio
res <- riskParityPortfolio(Sigma)
names(res)
#> [1] "w"                          "relative_risk_contribution"
#> [3] "is_feasible"
res$w
#> [1] 0.32715962 0.27110678 0.14480081 0.09766356 0.15926922

# risk budgeting portfolio
res <- riskParityPortfolio(Sigma, b = c(0.4, 0.4, 0.1, 0.05, 0.05))
res$relative_risk_contribution
#> [1] 0.40 0.40 0.10 0.05 0.05

Documentation

For more detailed information, please check the vignette.

Citation

If you find this package useful in your research, please consider citing the following works:

Contributing

We welcome all sorts of contributions. Please feel free to open an issue to report a bug or discuss a feature request.

Links

Package: CRAN and GitHub.

README file: GitHub-readme.

Vignettes: CRAN-vignette, slides R/Finance 2019, slides RPP - Convex Optimization Course (HKUST), slides HKML meetup 2020, and tutorial - Data-driven Portfolio Optimization Course (HKUST)

Disclaimer

The information, software, and any additional resources contained in this repository are not intended as, and shall not be understood or construed as, financial advice. Past performance is not a reliable indicator of future results and investors may not recover the full amount invested. The authors of this repository accept no liability whatsoever for any loss or damage you may incur. Any opinions expressed in this repository are from the personal research and experience of the authors and are intended as educational material.

Metadata

Version

0.2.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows