Skip to main content

A package for optimizing asset selection using CVXPY.

Project description

CoreFolio

corefolio is a Python package for optimizing asset selection using CVXPY. It allows users to define a universe of assets, apply constraints, and optimize the portfolio based on specified criteria.

Installation

To install the package, use the following command:

pip install corefolio

Requirements

  • Python >= 3.10
  • pandas
  • cvxpy >= 1.6.2
  • pytest

Usage

import pandas as pd
from corefolio.optimizer import Optimizer
from corefolio.universe import Universe
from corefolio.constraint import MaxAssetsConstraint, MeanConstraint

# Define your universe and constraints
data = pd.DataFrame(
    {
        "ID": [1, 2, 3, 4], 
        "value": [10, 20, 30, 40], 
        "other_value": [5, 5, 5, 5]
    }
)
universe = Universe(data)
constraints = [
    MaxAssetsConstraint(max_assets=2), 
    MeanConstraint(column_name="other_value", tolerance=0.01)
]

# Create an optimizer instance
optimizer = Optimizer(universe, constraints, sense="maximize", target_column="value")

# Optimize the portfolio
selected_assets = optimizer.optimize()

print("Selected assets:", selected_assets)

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

corefolio-0.2.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

corefolio-0.2.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file corefolio-0.2.2.tar.gz.

File metadata

  • Download URL: corefolio-0.2.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for corefolio-0.2.2.tar.gz
Algorithm Hash digest
SHA256 74f34389384e62b469676b5cc9c6fc57021853cc1e17f95d23ff0296cd39c203
MD5 d0329b4b02c93a8edc6bf30a1e595e42
BLAKE2b-256 132ebc9d2b816b9bdb754f36623718dd49491c6be203864d4889a3d2ea78d115

See more details on using hashes here.

File details

Details for the file corefolio-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: corefolio-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for corefolio-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa79e1471a051186d49f81fa31da783f19afe77b62a94632916efa73b015781c
MD5 814ddc5d1221fd51b541096145064021
BLAKE2b-256 3eb941fc70b7ada7b0181dbcb17e7234bdf94a425b13440a4b1c845e446115d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page