Git Product home page Git Product logo

cptopt's Introduction

Portfolio Optimization with Cumulative Prospect Theory Utility via Convex Optimization

This repo accompanies our paper.

Installation

The cptopt package can be installed using pip as follows

pip install git+https://github.com/cvxgrp/cptopt.git

Minimum working example

We are unable to provide the full data set used in the paper for licensing reasons. We, therefore, give a minimum working example using simulated data below.

import numpy as np
from scipy.stats import multivariate_normal as normal

from cptopt.optimizer import MinorizationMaximizationOptimizer, ConvexConcaveOptimizer, \
    MeanVarianceFrontierOptimizer, GradientOptimizer
from cptopt.utility import CPTUtility

# Generate returns
corr = np.array([
    [1, -.2, -.4],
    [-.2, 1, .5],
    [-.4, .5, 1]
])
sd = np.array([.01, .1, .2])
Sigma = np.diag(sd) @ corr @ np.diag(sd)

np.random.seed(0)
r = normal.rvs([.03, .1, .193], Sigma, size=100)

# Define utility function
utility = CPTUtility(
    gamma_pos=8.4, gamma_neg=11.4,
    delta_pos=.77, delta_neg=.79
)

initial_weights = np.array([1/3, 1/3, 1/3])

# Optimize
mv = MeanVarianceFrontierOptimizer(utility)
mv.optimize(r, verbose=True)

mm = MinorizationMaximizationOptimizer(utility)
mm.optimize(r, initial_weights=initial_weights, verbose=True)

cc = ConvexConcaveOptimizer(utility)
cc.optimize(r, initial_weights=initial_weights, verbose=True)

ga = GradientOptimizer(utility)
ga.optimize(r, initial_weights=initial_weights, verbose=True)

The optimal weights can then be accessed via the weights property.

mv.weights
mm.weights
cc.weights
ga.weights

Citing

If you want to reference our paper in your research, please consider citing us by using the following BibTeX:

@article{luxenberg2024cptopt,
  title={Portfolio Optimization with Cumulative Prospect Theory Utility via Convex Optimization},
  author={Luxenberg, Eric and Schiele, Philipp and Boyd, Stephen},
  journal={Computational Economics},
  pages={1--21},
  year={2024},
  doi = {https://doi.org/10.1007/s10614-024-10556-x},
  publisher={Springer},
  url = {https://web.stanford.edu/\%7Eboyd/papers/pdf/cpt_opt.pdf},
}

cptopt's People

Contributors

phschiele avatar ericlux avatar

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.