在github上提了issue,现把内容复制过来
环境
- 操作系统: Ubuntu 22.04
- Python版本: Python 3.10.8
- VeighNa版本: 3.5.0
Issue类型
三选一:Bug
预期程序行为
正常连接或报相关业务错误
实际程序行为
segmentation fault (core dumped)
重现步骤
以下是run.py脚本内容
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
from vnpy_tts import TtsGateway
from vnpy_ctastrategy import CtaStrategyApp
from vnpy_ctabacktester import CtaBacktesterApp
from vnpy_scripttrader import ScriptTraderApp
from vnpy_chartwizard import ChartWizardApp
def main():
""""""
qapp = create_qapp()
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
# main_engine.add_gateway(CtpGateway)
# NOTE: tts gateway和ctp gateway不能同时使用,否则会报错4097, tts使用了魔改dll, ctp使用的是官方dll,两个同时使用会优先使用官方dll连接tts
# NOTE: ref https://zhuanlan.zhihu.com/p/453332727
main_engine.add_gateway(TtsGateway)
main_engine.add_app(CtaStrategyApp)
main_engine.add_app(CtaBacktesterApp)
main_engine.add_app(ScriptTraderApp)
main_engine.add_app(ChartWizardApp)
main_window = MainWindow(main_engine, event_engine)
main_window.showMaximized()
qapp.exec()
if __name__ == "__main__":
main()
填写连接信息点击连接以后直接报segmentation fault.
我写了个脚本测试了一下tts和ctp,只有tts报段错误,不清楚是魔改的动态链接库报错还是vnpy_tts报错。
附上脚本
import time
from vnpy.event import EventEngine, Event
# from vnpy_tts import TtsGateway
from vnpy_ctp import CtpGateway
ee = EventEngine()
# gw = TtsGateway(ee, 'tts_gateway')
gw = CtpGateway(ee, 'ctp_gateway')
conf = {
"用户名": "{usercode}",
"密码": "{userpasswd}",
"经纪商代码": "1234",
"交易服务器": "tcp://42.192.226.242:20002",
"行情服务器": "tcp://180.169.112.54.42213",
"产品名称": "1234",
"授权编码": "1234"
}
gw.connect(conf)
for i in range(10):
print(f"sleep {i}")
time.sleep(3)