diff --git a/robo_executor.py b/robo_executor.py index a53a90ca850b4df41e04b4a4e245cef1af6bc99c..1c98c13d878cafecb86846ed122de45eb2c6cceb 100644 --- a/robo_executor.py +++ b/robo_executor.py @@ -90,36 +90,36 @@ class BacktestExecutor(RoboExecutor): self._rule.clear_signal() def start_exec(self): - if self.is_sync_data: - for sync in self._syncs: - sync.do_sync() - if self.is_clean_up: - self.clear_datas() - if self.start_step.within(BacktestStep.EWMA_VALUE) and self.end_step.without(BacktestStep.EWMA_VALUE): - logger.info("start to build fund ewma value.".center(50, '-')) - now = dt.now() - wait([self.async_build_risk_date(x['id']) for x in self._datum.get_datums(type=DatumType.FUND, risk=(3, 4, 5))]) - logger.info(f"build fund ewma value success, use[{(dt.now() - now).seconds}s]") - if self.start_step.within(BacktestStep.ASSET_POOL) and self.end_step.without(BacktestStep.ASSET_POOL): - logger.info("start to build asset pool".center(50, '-')) - now = dt.now() - workdays = workday_range(self.start_date, self.end_date) - for date in workdays: - self._risk.get_risk_pool(date) - for date in workdays: - self._pool.get_pool(date) - logger.info(f"build asset pool success, use[{(dt.now() - now).seconds}s]") - if self.start_step.within(BacktestStep.NORMAL_PORTFOLIO) and self.end_step.without(BacktestStep.NORMAL_PORTFOLIO): - logger.info("start to build normal portfolios".center(50, '-')) - now = dt.now() - wait([self.async_build_portfolios(day, risk) for risk in PortfoliosRisk for day in workday_range(self.start_date, self.end_date)]) - logger.info(f"build normal portfolios success, use[{(dt.now() - now).seconds}s]") - if self.start_step.within(BacktestStep.HOLD_PORTFOLIO) and self.end_step.without(BacktestStep.HOLD_PORTFOLIO): - logger.info("start to build hold portfolios".center(50, '-')) - now = dt.now() - wait([self.async_build_hold(x) for x in PortfoliosRisk]) - logger.info(f"build hold portfolios success, use[{(dt.now() - now).seconds}s]") - logger.info("start to export report".center(50, '-')) + # if self.is_sync_data: + # for sync in self._syncs: + # sync.do_sync() + # if self.is_clean_up: + # self.clear_datas() + # if self.start_step.within(BacktestStep.EWMA_VALUE) and self.end_step.without(BacktestStep.EWMA_VALUE): + # logger.info("start to build fund ewma value.".center(50, '-')) + # now = dt.now() + # wait([self.async_build_risk_date(x['id']) for x in self._datum.get_datums(type=DatumType.FUND, risk=(3, 4, 5))]) + # logger.info(f"build fund ewma value success, use[{(dt.now() - now).seconds}s]") + # if self.start_step.within(BacktestStep.ASSET_POOL) and self.end_step.without(BacktestStep.ASSET_POOL): + # logger.info("start to build asset pool".center(50, '-')) + # now = dt.now() + # workdays = workday_range(self.start_date, self.end_date) + # for date in workdays: + # self._risk.get_risk_pool(date) + # for date in workdays: + # self._pool.get_pool(date) + # logger.info(f"build asset pool success, use[{(dt.now() - now).seconds}s]") + # if self.start_step.within(BacktestStep.NORMAL_PORTFOLIO) and self.end_step.without(BacktestStep.NORMAL_PORTFOLIO): + # logger.info("start to build normal portfolios".center(50, '-')) + # now = dt.now() + # wait([self.async_build_portfolios(day, risk) for risk in PortfoliosRisk for day in workday_range(self.start_date, self.end_date)]) + # logger.info(f"build normal portfolios success, use[{(dt.now() - now).seconds}s]") + # if self.start_step.within(BacktestStep.HOLD_PORTFOLIO) and self.end_step.without(BacktestStep.HOLD_PORTFOLIO): + # logger.info("start to build hold portfolios".center(50, '-')) + # now = dt.now() + # wait([self.async_build_hold(x) for x in PortfoliosRisk]) + # logger.info(f"build hold portfolios success, use[{(dt.now() - now).seconds}s]") + # logger.info("start to export report".center(50, '-')) now = dt.now() file = self._export.export(max_date=self.end_date) logger.info(f"report file[{os.path.basename(file)}] exported successfully. use[{(dt.now() - now).seconds}s].")