a opt tool
Project description
QuantOPT
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
QuantOPT-0.1.1.4-py3-none-any.whl
(26.3 kB
view hashes)
Close
Hashes for QuantOPT-0.1.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d8ce2c197b7c96c996c9a29983796021dab03f54945de2a817d22687e89ed3f |
|
MD5 | d5c4b119d1c37a9684608e75abe09499 |
|
BLAKE2b-256 | 7028e02cb1f349f448169c441a6fc342ee11f1d45858a938ef76764f58a22378 |