Portfolio Optimization and Quantitative Strategic Asset Allocation in Python

Overview

Riskfolio-Lib

Quantitative Strategic Asset Allocation, Easy for Everyone.

Buy Me a Coffee at ko-fi.com

GitHub stars Downloads Documentation Status GitHub license Binder

Description

Riskfolio-Lib is a library for making quantitative strategic asset allocation or portfolio optimization in Python made in Peru 🇵🇪 . Its objective is to help students, academics and practitioners to build investment portfolios based on mathematically complex models with low effort. It is built on top of cvxpy and closely integrated with pandas data structures.

Some of key functionalities that Riskfolio-Lib offers:

  • Mean Risk and Logarithmic Mean Risk (Kelly Criterion) Portfolio Optimization with 4 objective functions:

    • Minimum Risk.
    • Maximum Return.
    • Maximum Utility Function.
    • Maximum Risk Adjusted Return Ratio.
  • Mean Risk and Logarithmic Mean Risk (Kelly Criterion) Portfolio Optimization with 13 convex risk measures:

    • Standard Deviation.
    • Semi Standard Deviation.
    • Mean Absolute Deviation (MAD).
    • First Lower Partial Moment (Omega Ratio).
    • Second Lower Partial Moment (Sortino Ratio).
    • Conditional Value at Risk (CVaR).
    • Entropic Value at Risk (EVaR).
    • Worst Case Realization (Minimax Model).
    • Maximum Drawdown (Calmar Ratio) for uncompounded cumulative returns.
    • Average Drawdown for uncompounded cumulative returns.
    • Conditional Drawdown at Risk (CDaR) for uncompounded cumulative returns.
    • Entropic Drawdown at Risk (EDaR) for uncompounded cumulative returns.
    • Ulcer Index for uncompounded cumulative returns.
  • Risk Parity Portfolio Optimization with 10 convex risk measures:

    • Standard Deviation.
    • Semi Standard Deviation.
    • Mean Absolute Deviation (MAD).
    • First Lower Partial Moment (Omega Ratio).
    • Second Lower Partial Moment (Sortino Ratio).
    • Conditional Value at Risk (CVaR).
    • Entropic Value at Risk (EVaR).
    • Conditional Drawdown at Risk (CDaR) for uncompounded cumulative returns.
    • Entropic Drawdown at Risk (EDaR) for uncompounded cumulative returns.
    • Ulcer Index for uncompounded cumulative returns.
  • Hierarchical Clustering Portfolio Optimization: Hierarchical Risk Parity (HRP) and Hierarchical Equal Risk Contribution (HERC) with 22 risk measures:

    • Standard Deviation.
    • Variance.
    • Semi Standard Deviation.
    • Mean Absolute Deviation (MAD).
    • First Lower Partial Moment (Omega Ratio).
    • Second Lower Partial Moment (Sortino Ratio).
    • Value at Risk (VaR).
    • Conditional Value at Risk (CVaR).
    • Entropic Value at Risk (EVaR).
    • Worst Case Realization (Minimax Model).
    • Maximum Drawdown (Calmar Ratio) for compounded and uncompounded cumulative returns.
    • Average Drawdown for compounded and uncompounded cumulative returns.
    • Drawdown at Risk (DaR) for compounded and uncompounded cumulative returns.
    • Conditional Drawdown at Risk (CDaR) for compounded and uncompounded cumulative returns.
    • Entropic Drawdown at Risk (EDaR) for compounded and uncompounded cumulative returns.
    • Ulcer Index for compounded and uncompounded cumulative returns.
  • Nested Clustered Optimization (NCO) with four objective functions and the available risk measures to each objective:

    • Minimum Risk.
    • Maximum Return.
    • Maximum Utility Function.
    • Equal Risk Contribution.
  • Worst Case Mean Variance Portfolio Optimization.

  • Relaxed Risk Parity Portfolio Optimization.

  • Portfolio optimization with Black Litterman model.

  • Portfolio optimization with Risk Factors model.

  • Portfolio optimization with Black Litterman Bayesian model.

  • Portfolio optimization with Augmented Black Litterman model.

  • Portfolio optimization with constraints on tracking error and turnover.

  • Portfolio optimization with short positions and leveraged portfolios.

  • Portfolio optimization with constraints on number of assets and number of effective assets.

  • Tools to build efficient frontier for 13 risk measures.

  • Tools to build linear constraints on assets, asset classes and risk factors.

  • Tools to build views on assets and asset classes.

  • Tools to build views on risk factors.

  • Tools to calculate risk measures.

  • Tools to calculate risk contributions per asset.

  • Tools to calculate uncertainty sets for mean vector and covariance matrix.

  • Tools to calculate assets clusters based on codependence metrics.

  • Tools to estimate loadings matrix (Stepwise Regression and Principal Components Regression).

  • Tools to visualizing portfolio properties and risk measures.

  • Tools to build reports on Jupyter Notebook and Excel.

  • Option to use commercial optimization solver like MOSEK or GUROBI for large scale problems.

Documentation

Online documentation is available at Documentation.

The docs include a tutorial with examples that shows the capacities of Riskfolio-Lib.

Dependencies

Riskfolio-Lib supports Python 3.7+.

Installation requires:

Installation

The latest stable release (and older versions) can be installed from PyPI:

pip install riskfolio-lib

Citing

If you use Riskfolio-Lib for published work, please use the following BibTeX entrie:

@misc{riskfolio,
      author = {Dany Cajas},
      title = {Riskfolio-Lib (2.0.0)},
      year  = {2021},
      url   = {https://github.com/dcajasn/Riskfolio-Lib},
      }

Development

Riskfolio-Lib development takes place on Github: https://github.com/dcajasn/Riskfolio-Lib

RoadMap

The plan for this module is to add more functions that will be very useful to asset managers.

  • Add more functions based on suggestion of users.
Owner
Riskfolio
Finance and Python lover, looking for job opportunities in quantitative finance, investments and risk management.
Riskfolio
ALFRED - A Benchmark for Interpreting Grounded Instructions for Everyday Tasks

ALFRED A Benchmark for Interpreting Grounded Instructions for Everyday Tasks Mohit Shridhar, Jesse Thomason, Daniel Gordon, Yonatan Bisk, Winson Han,

ALFRED 204 Dec 15, 2022
This is an official implementation of CvT: Introducing Convolutions to Vision Transformers.

Introduction This is an official implementation of CvT: Introducing Convolutions to Vision Transformers. We present a new architecture, named Convolut

Microsoft 408 Dec 30, 2022
A knowledge base construction engine for richly formatted data

Fonduer is a Python package and framework for building knowledge base construction (KBC) applications from richly formatted data. Note that Fonduer is

HazyResearch 386 Dec 05, 2022
You Only 👀 One Sequence

You Only 👀 One Sequence TL;DR: We study the transferability of the vanilla ViT pre-trained on mid-sized ImageNet-1k to the more challenging COCO obje

Hust Visual Learning Team 666 Jan 03, 2023
A containerized REST API around OpenAI's CLIP model.

OpenAI's CLIP — REST API This is a container wrapping OpenAI's CLIP model in a RESTful interface. Running the container locally First, build the conta

Santiago Valdarrama 48 Nov 06, 2022
SpinalNet: Deep Neural Network with Gradual Input

SpinalNet: Deep Neural Network with Gradual Input This repository contains scripts for training different variations of the SpinalNet and its counterp

H M Dipu Kabir 142 Dec 30, 2022
A Graph Neural Network Tool for Recovering Dense Sub-graphs in Random Dense Graphs.

PYGON A Graph Neural Network Tool for Recovering Dense Sub-graphs in Random Dense Graphs. Installation This code requires to install and run the graph

Yoram Louzoun's Lab 0 Jun 25, 2021
A dead simple python wrapper for darknet that works with OpenCV 4.1, CUDA 10.1

What Dead simple python wrapper for Yolo V3 using AlexyAB's darknet fork. Works with CUDA 10.1 and OpenCV 4.1 or later (I use OpenCV master as of Jun

Pliable Pixels 6 Jan 12, 2022
A PyTorch implementation of the architecture of Mask RCNN

EDIT (AS OF 4th NOVEMBER 2019): This implementation has multiple errors and as of the date 4th, November 2019 is insufficient to be utilized as a reso

Sai Himal Allu 975 Dec 30, 2022
NudeNet: Neural Nets for Nudity Classification, Detection and selective censoring

NudeNet: Neural Nets for Nudity Classification, Detection and selective censoring Uncensored version of the following image can be found at https://i.

notAI.tech 1.1k Dec 29, 2022
Pytorch implementation of paper: "NeurMiPs: Neural Mixture of Planar Experts for View Synthesis"

NeurMips: Neural Mixture of Planar Experts for View Synthesis This is the official repo for PyTorch implementation of paper "NeurMips: Neural Mixture

James Lin 101 Dec 13, 2022
A simple Neural Network that predicts the label for a series of handwritten digits

Neural_Network A simple Neural Network that predicts the label for a series of handwritten numbers This program tries to predict the label (1,2,3 etc.

Ty 1 Dec 18, 2021
Bulk2Space is a spatial deconvolution method based on deep learning frameworks

Bulk2Space Spatially resolved single-cell deconvolution of bulk transcriptomes using Bulk2Space Bulk2Space is a spatial deconvolution method based on

Dr. FAN, Xiaohui 60 Dec 27, 2022
EPSANet:An Efficient Pyramid Split Attention Block on Convolutional Neural Network

EPSANet:An Efficient Pyramid Split Attention Block on Convolutional Neural Network This repo contains the official Pytorch implementaion code and conf

Hu Zhang 175 Jan 07, 2023
NVIDIA Deep Learning Examples for Tensor Cores

NVIDIA Deep Learning Examples for Tensor Cores Introduction This repository provides State-of-the-Art Deep Learning examples that are easy to train an

NVIDIA Corporation 10k Dec 31, 2022
Official PyTorch implementation of "Improving Face Recognition with Large AgeGaps by Learning to Distinguish Children" (BMVC 2021)

Inter-Prototype (BMVC 2021): Official Project Webpage This repository provides the official PyTorch implementation of the following paper: Improving F

Jungsoo Lee 16 Jun 30, 2022
This is the PyTorch implementation of GANs N’ Roses: Stable, Controllable, Diverse Image to Image Translation

Official PyTorch repo for GAN's N' Roses. Diverse im2im and vid2vid selfie to anime translation.

1.1k Jan 01, 2023
FEMDA: Robust classification with Flexible Discriminant Analysis in heterogeneous data

FEMDA: Robust classification with Flexible Discriminant Analysis in heterogeneous data. Flexible EM-Inspired Discriminant Analysis is a robust supervised classification algorithm that performs well i

0 Sep 06, 2022
Repository for MDPGT

MD-PGT Repository for implementing and reproducing the results for the paper MDPGT: Momentum-based Decentralized Policy Gradient Tracking. Available E

Xian Yeow Lee 2 Dec 30, 2021
This repository contains project created during the Data Challenge module at London School of Hygiene & Tropical Medicine

LSHTM_RCS This repository contains project created during the Data Challenge module at London School of Hygiene & Tropical Medicine (LSHTM) in collabo

Lukas Kopecky 3 Jan 30, 2022