Skip to main content

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.

Release files for corefolio 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for corefolio 0.2.2
File Size Uploaded
corefolio-0.2.2.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for corefolio 0.2.2
File Interpreter ABI Platform
corefolio-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / corefolio-0.2.2.tar.gz

Download URL corefolio-0.2.2.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
74f34389384e62b469676b5cc9c6fc57021853cc1e17f95d23ff0296cd39c203
BLAKE2b-256 checksum
How to use checksums
132ebc9d2b816b9bdb754f36623718dd49491c6be203864d4889a3d2ea78d115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / corefolio-0.2.2-py3-none-any.whl

Download URL corefolio-0.2.2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa79e1471a051186d49f81fa31da783f19afe77b62a94632916efa73b015781c
BLAKE2b-256 checksum
How to use checksums
3eb941fc70b7ada7b0181dbcb17e7234bdf94a425b13440a4b1c845e446115d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page