1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-10 22:36:55 +08:00

update workflow_by_code & update executor

This commit is contained in:
bxdd
2021-06-01 17:44:22 +08:00
parent a46d99a2be
commit a183d8a631
4 changed files with 37 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ from .backtest import backtest as backtest_func
from .backtest import collect_data as data_generator
from .utils import CommonInfrastructure
from .order import Order
from ..strategy.base import BaseStrategy
from ..utils import init_instance_by_config
from ..log import get_module_logger

View File

@@ -118,6 +118,9 @@ class BaseExecutor:
def get_report(self):
raise NotImplementedError("get_report is not implemented!")
def get_all_executor(self):
return [self]
class NestedExecutor(BaseExecutor):
"""
@@ -244,6 +247,9 @@ class NestedExecutor(BaseExecutor):
sub_env_report_dict.update({f"{_count}{_freq}": (_report, _positions)})
return sub_env_report_dict
def get_all_executor(self):
return [self, *self.inner_executor.get_all_executor()]
class SimulatorExecutor(BaseExecutor):
"""Executor that simulate the true market"""

View File

@@ -11,10 +11,11 @@ class Order:
stock_id : str
amount : float
start_time : pd.Timestamp
closed start time for order generation
closed start time for order trading
end_time : pd.Timestamp
closed end time for order generation
direction : Order.SELL for sell; Order.BUY for buy
closed end time for order trading
direction : int
Order.SELL for sell; Order.BUY for buy
factor : float
presents the weight factor assigned in Exchange()
"""