diff --git a/qlib/backtest/executor.py b/qlib/backtest/executor.py index d46fc96c5..13af7aea7 100644 --- a/qlib/backtest/executor.py +++ b/qlib/backtest/executor.py @@ -464,7 +464,6 @@ class NestedExecutor(BaseExecutor): ) assert isinstance(_inner_execute_result, list) self.post_inner_exe_step(_inner_execute_result) - self.inner_strategy.receive_execute_result(_inner_execute_result) execute_result.extend(_inner_execute_result) inner_order_indicators.append( @@ -485,6 +484,7 @@ class NestedExecutor(BaseExecutor): inner_exe_res : the execution result of inner task """ + self.inner_strategy.post_exe_step(inner_exe_res) def get_all_executors(self) -> List[BaseExecutor]: """get all executors, including self and inner_executor.get_all_executors()""" diff --git a/qlib/rl/order_execution/simulator_qlib.py b/qlib/rl/order_execution/simulator_qlib.py index 6b6498d92..c48aa4c18 100644 --- a/qlib/rl/order_execution/simulator_qlib.py +++ b/qlib/rl/order_execution/simulator_qlib.py @@ -48,7 +48,7 @@ class DecomposedStrategy(BaseStrategy): def alter_outer_trade_decision(self, outer_trade_decision: BaseTradeDecision) -> BaseTradeDecision: return outer_trade_decision - def receive_execute_result(self, execute_result: list) -> None: + def post_exe_step(self, execute_result: list) -> None: self.execute_result = execute_result def reset(self, outer_trade_decision: TradeDecisionWO = None, **kwargs) -> None: diff --git a/qlib/strategy/base.py b/qlib/strategy/base.py index 14b3d30bf..5e61221a8 100644 --- a/qlib/strategy/base.py +++ b/qlib/strategy/base.py @@ -207,8 +207,15 @@ class BaseStrategy: range_limit = self.outer_trade_decision.get_data_cal_range_limit(rtype=rtype) return max(cal_range[0], range_limit[0]), min(cal_range[1], range_limit[1]) - def receive_execute_result(self, execute_result: list) -> None: - pass + def post_exe_step(self, execute_result: list) -> None: + """ + A hook for doing sth after the corresponding executor finished its execution. + + Parameters + ---------- + execute_result : + the execution result + """ class RLStrategy(BaseStrategy, metaclass=ABCMeta):