请问一下,有没有大神解决的求解决,行情管理只能手动添加单个合约,如何能够默认将CTP所有实时合约数据进行下载
请问一下,有没有大神解决的求解决,行情管理只能手动添加单个合约,如何能够默认将CTP所有实时合约数据进行下载
将vnpy/app/data_recorder/engine.py文件中的RecorderEngine中的add_bar_recording函数修改为
def add_bar_recording(self, vt_symbol: str):
""""""
if vt_symbol in self.bar_recordings:
self.write_log(f"已在K线记录列表中:{vt_symbol}")
return
if Exchange.LOCAL.value not in vt_symbol:
"""将所有行情数据进行下载保存"""
all_contract = self.main_engine.get_all_contracts()
for contract in all_contract:
vt_symbol = contract.vt_symbol
self.bar_recordings[vt_symbol] = {
"symbol": contract.symbol,
"exchange": contract.exchange.value,
"gateway_name": contract.gateway_name
}
self.subscribe(contract)
else:
self.tick_recordings[vt_symbol] = {}
self.save_setting()
self.put_event()
self.write_log(f"添加K线记录成功:{vt_symbol}")