Skip to main content

a opt tool

Project description

QuantOPT

Description

This module is to create and run optimizer for the portfolio optimization. it will have constraints with soft slack version and objects

main functions:

  1. RunOpt, main functions with slack constraints path
  2. create_constraints_holder, the creator for custom constraints with string
  3. Holder, model holder which can be defined by custom or new model

Usage

from QuantOPT.constraints.relaxer import RunOpt
from QuantOPT.constraints.constraints import create_constraints_holder
from QuantOPT.core.model_core import Holder
import numpy as np
## add model
class risk_budge: 
    @staticmethod
    def loss_func(w):
        return np.sum(w)
Holder.add_model('risk_budge',risk_budge)

cov_price= stock_price.pct_change(1).cov()

stock_pool = len(cov_price.columns)

## init constraints
setting_yaml_path = './constraints.yaml'
constr_cls = create_constraints_holder(setting_yaml_path)
method = 'MinVar'

Ropt = RunOpt(method=method, constr_cls=constr_cls)

constraint_param_list = [('general_count_lower_rc', {'bound_value': 5}, 1, 'ineq')]
res = Ropt.run_opt(constraint_param_list, slack=True,stockpool=stock_pool, sigma2=cov_price)

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

QuantOPT-0.1.1.7.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

QuantOPT-0.1.1.7-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file QuantOPT-0.1.1.7.tar.gz.

File metadata

  • Download URL: QuantOPT-0.1.1.7.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for QuantOPT-0.1.1.7.tar.gz
Algorithm Hash digest
SHA256 867c19da523b360a48061cec3ba3a2f18f8bf4da94deda4addf77f6445559a8b
MD5 5fc8223c9148ce106f56a2e8578f81ed
BLAKE2b-256 dd80cc45baee8f6fa032da7aaaa1ecfea2161e4dd1046e9a84ec41f6b6c3104f

See more details on using hashes here.

File details

Details for the file QuantOPT-0.1.1.7-py3-none-any.whl.

File metadata

  • Download URL: QuantOPT-0.1.1.7-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for QuantOPT-0.1.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8aece979261cd785c8aca8977b76f0bd9c43e4ffb7386b60827069a6e6f66fa4
MD5 dcde9d1f43ab96a6ef424bfa69b1a93a
BLAKE2b-256 299ffbdad7166f16a4b9cc0519016dbc8c5eb2a64634cb2b350d66091a690a17

See more details on using hashes here.

Supported by

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