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)
Metadata
Release files for QuantOPT 0.1.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| QuantOPT-0.1.1.8.tar.gz | 18.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| QuantOPT-0.1.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.0 kB
Release files / QuantOPT-0.1.1.8.tar.gz
| Download URL | QuantOPT-0.1.1.8.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9b3f3db35aec032dd836ef6c2a6e44465373e54326b49b23f695add21a239c9
|
|
BLAKE2b-256 checksum How to use checksums |
78199f572e2e5e3270cc49f6d95331c1630d554a6020f506ac671476da909d49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.18
|
Release files / QuantOPT-0.1.1.8-py3-none-any.whl
| Download URL | QuantOPT-0.1.1.8-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b442fd881a3b6b0eb295ac327b5b39049d4f5b7c4efbfdd0d3a2554de5629ec
|
|
BLAKE2b-256 checksum How to use checksums |
4a1d5de21c634ceeb00f892b6dbbdb3ce9cc1286d416253730a03d6d67ecc078
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.18
|