mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-16 09:11:00 +08:00
datahandler support explicit selector & PortAnaRecord support strategy instance
This commit is contained in:
@@ -51,6 +51,9 @@ def fetch_df_by_index(
|
|||||||
-------
|
-------
|
||||||
Data of the given index.
|
Data of the given index.
|
||||||
"""
|
"""
|
||||||
|
# level = None -> use selector directly
|
||||||
|
if level == None:
|
||||||
|
return df.loc(axis=0)[selector]
|
||||||
# Try to get the right index
|
# Try to get the right index
|
||||||
idx_slc = (selector, slice(None, None))
|
idx_slc = (selector, slice(None, None))
|
||||||
if get_level_index(df, level) == 1:
|
if get_level_index(df, level) == 1:
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from ..utils import init_instance_by_config, get_module_by_module_path
|
|||||||
from ..log import get_module_logger
|
from ..log import get_module_logger
|
||||||
from ..utils import flatten_dict
|
from ..utils import flatten_dict
|
||||||
from ..contrib.eva.alpha import calc_ic, calc_long_short_return
|
from ..contrib.eva.alpha import calc_ic, calc_long_short_return
|
||||||
|
from ..contrib.strategy.strategy import BaseStrategy
|
||||||
|
|
||||||
logger = get_module_logger("workflow", "INFO")
|
logger = get_module_logger("workflow", "INFO")
|
||||||
|
|
||||||
@@ -220,7 +221,7 @@ class PortAnaRecord(SignalRecord):
|
|||||||
|
|
||||||
self.strategy_config = config["strategy"]
|
self.strategy_config = config["strategy"]
|
||||||
self.backtest_config = config["backtest"]
|
self.backtest_config = config["backtest"]
|
||||||
self.strategy = init_instance_by_config(self.strategy_config)
|
self.strategy = init_instance_by_config(self.strategy_config, accept_types=BaseStrategy)
|
||||||
|
|
||||||
def generate(self, **kwargs):
|
def generate(self, **kwargs):
|
||||||
# check previously stored prediction results
|
# check previously stored prediction results
|
||||||
|
|||||||
Reference in New Issue
Block a user