mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-17 17:34:35 +08:00
Update __init__.py.
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
from .base import RiskModel
|
||||||
|
from .poet import POETCovEstimator
|
||||||
|
from .shrink import ShrinkCovEstimator
|
||||||
|
from .structured import StructuredCovEstimator
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ from typing import Union
|
|||||||
|
|
||||||
from qlib.model.base import BaseModel
|
from qlib.model.base import BaseModel
|
||||||
|
|
||||||
from qlib.model.riskmodel_poet import POETCovEstimator
|
|
||||||
from qlib.model.riskmodel_shrink import ShrinkCovEstimator
|
|
||||||
from qlib.model.riskmodel_structured import StructuredCovEstimator
|
|
||||||
|
|
||||||
|
|
||||||
class RiskModel(BaseModel):
|
class RiskModel(BaseModel):
|
||||||
"""Risk Model
|
"""Risk Model
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
from .base import BaseOptimizer
|
||||||
|
from .optimizer import PortfolioOptimizer
|
||||||
|
from .enhanced_indexing import EnhancedIndexingOptimizer
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
import abc
|
||||||
|
|
||||||
|
|
||||||
|
class BaseOptimizer(abc.ABC):
|
||||||
|
""" Construct portfolio with a optimization related method """
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def __call__(self, *args, **kwargs) -> object:
|
||||||
|
""" Generate a optimized portfolio allocation """
|
||||||
|
pass
|
||||||
|
|||||||
@@ -1,23 +1,14 @@
|
|||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
import abc
|
|
||||||
import warnings
|
import warnings
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import scipy.optimize as so
|
import scipy.optimize as so
|
||||||
from typing import Optional, Union, Callable, List
|
from typing import Optional, Union, Callable, List
|
||||||
|
|
||||||
from qlib.portfolio.enhanced_indexing import EnhancedIndexingOptimizer
|
from qlib.portfolio.optimizer import BaseOptimizer
|
||||||
|
|
||||||
|
|
||||||
class BaseOptimizer(abc.ABC):
|
|
||||||
""" Construct portfolio with a optimization related method """
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def __call__(self, *args, **kwargs) -> object:
|
|
||||||
""" Generate a optimized portfolio allocation """
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class PortfolioOptimizer(BaseOptimizer):
|
class PortfolioOptimizer(BaseOptimizer):
|
||||||
|
|||||||
Reference in New Issue
Block a user