A Python Package for Portfolio Optimization using the Critical Line Algorithm

Related tags

Deep Learning PyCLA
Overview

PyCLA

A Python Package for Portfolio Optimization using the Critical Line Algorithm

Getting started

To use PyCLA, clone the repo and install the required dependencies.

git clone https://github.com/phschiele/PyCLA

Dependency installation using poetry:

poetry install

Dependency installation using pip:

pip install -r requirements.txt

Using PyCLA - An Example

import numpy as np

from pycla import PyCLA

n_sec = 10

# Expected returns and covariance matrix
np.random.seed(1)
mu = np.random.random(n_sec)
random_mat = np.random.rand(n_sec, n_sec)
C = np.dot(random_mat, random_mat.transpose())

# Lower and upper bounds
lb = np.ones(n_sec) * 0.05
ub = np.ones(n_sec) * 0.7

# Equality constraints
A = np.ones((1, n_sec))
b = np.array([1])

# Inequality constraints
first_n = 5  # combined weight of first five assets <= 50%
A_in = np.array([[1]*first_n + [0]*(n_sec-first_n)])
b_in = np.array([0.5])

# Create the PyCLA object and trace the frontier
pycla = PyCLA(mu, C, A, b, A_in, b_in, lb, ub)
pycla.trace_frontier()
You might also like...
library for nonlinear optimization, wrapping many algorithms for global and local, constrained or unconstrained, optimization

NLopt is a library for nonlinear local and global optimization, for functions with and without gradient information. It is designed as a simple, unifi

A tf.keras implementation of Facebook AI's MadGrad optimization algorithm
A tf.keras implementation of Facebook AI's MadGrad optimization algorithm

MADGRAD Optimization Algorithm For Tensorflow This package implements the MadGrad Algorithm proposed in Adaptivity without Compromise: A Momentumized,

ppo_pytorch_cpp - an implementation of the proximal policy optimization algorithm for the C++ API of Pytorch
ppo_pytorch_cpp - an implementation of the proximal policy optimization algorithm for the C++ API of Pytorch

PPO Pytorch C++ This is an implementation of the proximal policy optimization algorithm for the C++ API of Pytorch. It uses a simple TestEnvironment t

Gradient-free global optimization algorithm for multidimensional functions based on the low rank tensor train format

ttopt Description Gradient-free global optimization algorithm for multidimensional functions based on the low rank tensor train (TT) format and maximu

An implementation of the proximal policy optimization algorithm
An implementation of the proximal policy optimization algorithm

PPO Pytorch C++ This is an implementation of the proximal policy optimization algorithm for the C++ API of Pytorch. It uses a simple TestEnvironment t

A simple and lightweight genetic algorithm for optimization of any machine learning model

geneticml This package contains a simple and lightweight genetic algorithm for optimization of any machine learning model. Installation Use pip to ins

Reinforcement Learning for Portfolio Management

qtrader Reinforcement Learning for Portfolio Management Why Reinforcement Learning? Learns the optimal action, rather than models the market. Adaptive

Use AI to generate a optimized stock portfolio
Use AI to generate a optimized stock portfolio

Use AI, Modern Portfolio Theory, and Monte Carlo simulation's to generate a optimized stock portfolio that minimizes risk while maximizing returns. Ho

This package is for running the semantic SLAM algorithm using extracted planar surfaces from the received detection
This package is for running the semantic SLAM algorithm using extracted planar surfaces from the received detection

Semantic SLAM This package can perform optimization of pose estimated from VO/VIO methods which tend to drift over time. It uses planar surfaces extra

Comments
  • Fix unimport linter repo URL.

    Fix unimport linter repo URL.

    Thank you for using Unimport, there was a slight change in the URL, the old URL works because it is redirected to the new one, but I changed it to the new one just in case.

    opened by hakancelikdev 1
  • Weights given volatility target

    Weights given volatility target

    Hi,

    Thank you for developing this package. I was playing a bit with it and I am wondering how to increase the number of points computed to draw the efficient frontier? With my input, only 9 points are computed, which is too low to achieve my goal of finding the optimal weights for a given volatility target (let say 10%). Is there a way to achieve what I am looking for?

    opened by HedgeShot 2
Owner
Scalable Capital | Ludwig Maximilian University of Munich
null
Racing line optimization algorithm in python that uses Particle Swarm Optimization.

Racing Line Optimization with PSO This repository contains a racing line optimization algorithm in python that uses Particle Swarm Optimization. Requi

Parsa Dahesh 6 Dec 14, 2022
PGPortfolio: Policy Gradient Portfolio, the source code of "A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem"(https://arxiv.org/pdf/1706.10059.pdf).

This is the original implementation of our paper, A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem (arXiv:1706.1

Zhengyao Jiang 1.5k Dec 29, 2022
Portfolio Optimization and Quantitative Strategic Asset Allocation in Python

Riskfolio-Lib Quantitative Strategic Asset Allocation, Easy for Everyone. Description Riskfolio-Lib is a library for making quantitative strategic ass

Riskfolio 1.7k Jan 7, 2023
Use graph-based analysis to re-classify stocks and to improve Markowitz portfolio optimization

Dynamic Stock Industrial Classification Use graph-based analysis to re-classify stocks and experiment different re-classification methodologies to imp

Sheng Yang 10 Dec 5, 2022
CFC-Net: A Critical Feature Capturing Network for Arbitrary-Oriented Object Detection in Remote Sensing Images

CFC-Net This project hosts the official implementation for the paper: CFC-Net: A Critical Feature Capturing Network for Arbitrary-Oriented Object Dete

ming71 55 Dec 12, 2022
Code for paper "A Critical Assessment of State-of-the-Art in Entity Alignment" (https://arxiv.org/abs/2010.16314)

A Critical Assessment of State-of-the-Art in Entity Alignment This repository contains the source code for the paper A Critical Assessment of State-of

Max Berrendorf 16 Oct 14, 2022
Unofficial pytorch implementation for Self-critical Sequence Training for Image Captioning. and others.

An Image Captioning codebase This is a codebase for image captioning research. It supports: Self critical training from Self-critical Sequence Trainin

Ruotian(RT) Luo 906 Jan 3, 2023
I decide to sync up this repo and self-critical.pytorch. (The old master is in old master branch for archive)

An Image Captioning codebase This is a codebase for image captioning research. It supports: Self critical training from Self-critical Sequence Trainin

Ruotian(RT) Luo 1.3k Dec 31, 2022
CRISCE: Automatically Generating Critical Driving Scenarios From Car Accident Sketches

CRISCE: Automatically Generating Critical Driving Scenarios From Car Accident Sketches This document describes how to install and use CRISCE (CRItical

Chair of Software Engineering II, Uni Passau 2 Feb 9, 2022
Implemented fully documented Particle Swarm Optimization algorithm (basic model with few advanced features) using Python programming language

Implemented fully documented Particle Swarm Optimization (PSO) algorithm in Python which includes a basic model along with few advanced features such as updating inertia weight, cognitive, social learning coefficients and maximum velocity of the particle.

null 9 Nov 29, 2022