我想获得CTP连接状态的返回值,CtpMdApi和CtpTdApi有login_status/connect_status变量,请问如何获取connect_status变量的值呢?
写了如下代码:
from vnpy_ctp.gateway.ctp_gateway import CtpMdApi,TdApi
engine2 = CtpMdApi(TdApi)
运行时报错:
Traceback (most recent call last):
File "C:\Users\wp61413_114147317492\期权交易\终稿\ScriptTrader_vnpy_impvplace_commodityDos.py", line 9, in <module>
engine2 = CtpMdApi(TdApi)
File "D:\veighna_studio\lib\site-packages\vnpy_ctp\gateway\ctp_gateway.py", line 250, in init
self.gateway_name: str = gateway.gateway_name
AttributeError: type object 'vnpy_ctp.api.vnctptd.TdApi' has no attribute 'gateway_name'
请问如何获取呢?谢谢!