ctp 报错 RuntimeError:can not open CFlow file in line of file ../../source/userapi/ThostFtdcUserApiImplBase.cpp

报错的代码在vnpy_ctp/gateway/ctp_gateway.py

path: Path = get_folder_path(self.gateway_name.lower())
self.createFtdcTraderApi((str(path) + "\\Td").encode("GBK"))

原因是路径错误
检查路径,并改为

path: Path = source_path / 'temp' / 'temp_gateway' / self.gateway.gateway_name
if not path.exists():
    path.mkdir(parents=True, exist_ok=True)
self.createFtdcMdApi((str(path) + "\\Md").encode("GBK"))
posted @ 2024-05-22 13:03  meizhengchao  阅读(86)  评论(0编辑  收藏  举报