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:
- RunOpt, main functions with slack constraints path
- create_constraints_holder, the creator for custom constraints with string
- 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
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
QuantOPT-0.1.1.8.tar.gz
(18.5 kB
view details)
Built Distribution
File details
Details for the file QuantOPT-0.1.1.8.tar.gz
.
File metadata
- Download URL: QuantOPT-0.1.1.8.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9b3f3db35aec032dd836ef6c2a6e44465373e54326b49b23f695add21a239c9 |
|
MD5 | b42bfb0204369daf0689d7019900ab97 |
|
BLAKE2b-256 | 78199f572e2e5e3270cc49f6d95331c1630d554a6020f506ac671476da909d49 |
File details
Details for the file QuantOPT-0.1.1.8-py3-none-any.whl
.
File metadata
- Download URL: QuantOPT-0.1.1.8-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b442fd881a3b6b0eb295ac327b5b39049d4f5b7c4efbfdd0d3a2554de5629ec |
|
MD5 | 2ea67574c825bcb164859204e041f660 |
|
BLAKE2b-256 | 4a1d5de21c634ceeb00f892b6dbbdb3ce9cc1286d416253730a03d6d67ecc078 |