Commit 876fa964 authored by jichao's avatar jichao

6258

parent 0a127541
......@@ -90,35 +90,35 @@ 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]")
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment