{"id":26123446,"url":"https://github.com/cvxgrp/cptopt","last_synced_at":"2026-03-15T19:13:41.004Z","repository":{"id":112064656,"uuid":"530000873","full_name":"cvxgrp/cptopt","owner":"cvxgrp","description":"Portfolio Optimization with Cumulative Prospect Theory Utility via Convex Optimization","archived":false,"fork":false,"pushed_at":"2024-05-13T15:43:48.000Z","size":27,"stargazers_count":37,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-26T10:13:43.546Z","etag":null,"topics":["convex-optimization","cumulative-prospect-theory","portfolio-optimization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cvxgrp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-28T23:04:57.000Z","updated_at":"2025-10-29T07:29:53.000Z","dependencies_parsed_at":"2024-05-13T17:09:14.899Z","dependency_job_id":"5c05dc5b-bfae-47eb-bdd1-f39b857040ea","html_url":"https://github.com/cvxgrp/cptopt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cvxgrp/cptopt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvxgrp%2Fcptopt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvxgrp%2Fcptopt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvxgrp%2Fcptopt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvxgrp%2Fcptopt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cvxgrp","download_url":"https://codeload.github.com/cvxgrp/cptopt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvxgrp%2Fcptopt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30549839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-15T15:03:43.933Z","status":"ssl_error","status_checked_at":"2026-03-15T15:03:37.630Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["convex-optimization","cumulative-prospect-theory","portfolio-optimization"],"created_at":"2025-03-10T15:53:15.759Z","updated_at":"2026-03-15T19:13:40.986Z","avatar_url":"https://github.com/cvxgrp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Portfolio Optimization with Cumulative Prospect Theory Utility via Convex Optimization\n\nThis repo accompanies our [paper](https://arxiv.org/abs/2209.03461).\n\n## Installation\n\nThe `cptopt` package can be installed using `pip` as follows\n\n```python\npip install git+https://github.com/cvxgrp/cptopt.git\n```\n\n## Minimum working example\nWe 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.\n```python\nimport numpy as np\nfrom scipy.stats import multivariate_normal as normal\n\nfrom cptopt.optimizer import MinorizationMaximizationOptimizer, ConvexConcaveOptimizer, \\\n    MeanVarianceFrontierOptimizer, GradientOptimizer\nfrom cptopt.utility import CPTUtility\n\n# Generate returns\ncorr = np.array([\n    [1, -.2, -.4],\n    [-.2, 1, .5],\n    [-.4, .5, 1]\n])\nsd = np.array([.01, .1, .2])\nSigma = np.diag(sd) @ corr @ np.diag(sd)\n\nnp.random.seed(0)\nr = normal.rvs([.03, .1, .193], Sigma, size=100)\n\n# Define utility function\nutility = CPTUtility(\n    gamma_pos=8.4, gamma_neg=11.4,\n    delta_pos=.77, delta_neg=.79\n)\n\ninitial_weights = np.array([1/3, 1/3, 1/3])\n\n# Optimize\nmv = MeanVarianceFrontierOptimizer(utility)\nmv.optimize(r, verbose=True)\n\nmm = MinorizationMaximizationOptimizer(utility)\nmm.optimize(r, initial_weights=initial_weights, verbose=True)\n\ncc = ConvexConcaveOptimizer(utility)\ncc.optimize(r, initial_weights=initial_weights, verbose=True)\n\nga = GradientOptimizer(utility)\nga.optimize(r, initial_weights=initial_weights, verbose=True)\n```\nThe optimal weights can then be accessed via the `weights` property.\n```py\nmv.weights\nmm.weights\ncc.weights\nga.weights\n```\n\n## Citing\nIf you want to reference our paper in your research, please consider citing us by using the following BibTeX:\n\n```BibTeX\n@article{luxenberg2024cptopt,\n  title={Portfolio Optimization with Cumulative Prospect Theory Utility via Convex Optimization},\n  author={Luxenberg, Eric and Schiele, Philipp and Boyd, Stephen},\n  journal={Computational Economics},\n  pages={1--21},\n  year={2024},\n  doi = {https://doi.org/10.1007/s10614-024-10556-x},\n  publisher={Springer},\n  url = {https://web.stanford.edu/\\%7Eboyd/papers/pdf/cpt_opt.pdf},\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvxgrp%2Fcptopt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvxgrp%2Fcptopt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvxgrp%2Fcptopt/lists"}