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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74f34389384e62b469676b5cc9c6fc57021853cc1e17f95d23ff0296cd39c203
|
|
| MD5 |
d0329b4b02c93a8edc6bf30a1e595e42
|
|
| BLAKE2b-256 |
132ebc9d2b816b9bdb754f36623718dd49491c6be203864d4889a3d2ea78d115
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa79e1471a051186d49f81fa31da783f19afe77b62a94632916efa73b015781c
|
|
| MD5 |
814ddc5d1221fd51b541096145064021
|
|
| BLAKE2b-256 |
3eb941fc70b7ada7b0181dbcb17e7234bdf94a425b13440a4b1c845e446115d1
|