Commit 19acecb9 authored by jichao's avatar jichao

使用异步框架

parent 73126aa9
......@@ -153,7 +153,8 @@ robo-executor: # 执行器相关
backtest: # 回测执行器相关
start-date: 2008-01-02 # 回测起始日期
end-date: 2022-11-01 # 回测截止日期
start-step: 1 # 回测从哪一步开始执行 1:计算资产ewma;2:计算资产池;3:计算最优投组:4:计算再平衡信号以及持仓投组
start-step: 3 # 回测从哪一步开始执行 1:计算资产ewma;2:计算资产池;3:计算最优投组:4:计算再平衡信号以及持仓投组
clean-up: off
real: # 实盘执行器
start-date: 2022-11-01 # 实盘开始时间
......
......@@ -13,7 +13,7 @@ class PortfoliosTest(unittest.TestCase):
@autowired(names={'builder': 'poem'})
def test_poem_build_portfolio(self, builder: PortfoliosBuilder = None):
result, detail = builder.build_portfolio(parse_date('2016-09-22'), PortfoliosType.NORMAL)
result, detail = builder.build_portfolio(parse_date('2008-01-21'), PortfoliosType.NORMAL)
self.logger.info("portfolios: ")
for risk, portfolio in result.items():
self.logger.info(risk.name)
......
......@@ -56,6 +56,9 @@ class BacktestExector(RoboExecutor):
def end_date(self):
return pd.to_datetime(self._config['end-date'])
def is_clean_up(self):
return self._config['clean-up'] if 'clean-up' in self._config else True
def clear_datas(self):
if self.start_step.within(BacktestStep.EWMA_VALUE):
logger.info('start to clear fund ewma value'.center(50, '-'))
......@@ -72,7 +75,8 @@ class BacktestExector(RoboExecutor):
self._rule.clear_signal()
def start_exec(self):
self.clear_datas()
if self.is_clean_up():
self.clear_datas()
if self.start_step.within(BacktestStep.EWMA_VALUE):
logger.info("start to build fund ewma value.".center(50, '-'))
now = dt.now()
......
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