[Fic] close #2021
This commit is contained in:
parent
8baafc5cf9
commit
0c1dc817b9
@ -76,7 +76,7 @@ def main():
|
||||
main_engine.add_gateway(CoinbaseGateway)
|
||||
|
||||
main_engine.add_app(CtaStrategyApp)
|
||||
# main_engine.add_app(CtaBacktesterApp)
|
||||
main_engine.add_app(CtaBacktesterApp)
|
||||
# main_engine.add_app(CsvLoaderApp)
|
||||
# main_engine.add_app(AlgoTradingApp)
|
||||
# main_engine.add_app(DataRecorderApp)
|
||||
|
@ -354,18 +354,24 @@ class BacktesterEngine(BaseEngine):
|
||||
|
||||
contract = self.main_engine.get_contract(vt_symbol)
|
||||
|
||||
# If history data provided in gateway, then query
|
||||
if contract and contract.history_data:
|
||||
data = self.main_engine.query_history(req, contract.gateway_name)
|
||||
# Otherwise use RQData to query data
|
||||
else:
|
||||
data = rqdata_client.query_history(req)
|
||||
try:
|
||||
# If history data provided in gateway, then query
|
||||
if contract and contract.history_data:
|
||||
data = self.main_engine.query_history(
|
||||
req, contract.gateway_name
|
||||
)
|
||||
# Otherwise use RQData to query data
|
||||
else:
|
||||
data = rqdata_client.query_history(req)
|
||||
|
||||
if data:
|
||||
database_manager.save_bar_data(data)
|
||||
self.write_log(f"{vt_symbol}-{interval}历史数据下载完成")
|
||||
else:
|
||||
self.write_log(f"数据下载失败,无法获取{vt_symbol}的历史数据")
|
||||
if data:
|
||||
database_manager.save_bar_data(data)
|
||||
self.write_log(f"{vt_symbol}-{interval}历史数据下载完成")
|
||||
else:
|
||||
self.write_log(f"数据下载失败,无法获取{vt_symbol}的历史数据")
|
||||
except Exception:
|
||||
msg = f"数据下载失败,触发异常:\n{traceback.format_exc()}"
|
||||
self.write_log(msg)
|
||||
|
||||
# Clear thread object handler.
|
||||
self.thread = None
|
||||
|
Loading…
Reference in New Issue
Block a user