Merge pull request #822 from cclauss/fix-undefined-name-xtpGateway_2

Fix undefined name xtpGateway (to dev this time)
This commit is contained in:
vn.py 2018-05-07 23:41:52 +08:00 committed by GitHub
commit 202a4009d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# 重载sys模块设置默认字符串编码方式为utf8 # 重载sys模块设置默认字符串编码方式为utf8
try:
reload # Python 2
except NameError: # Python 3
from importlib import reload
import sys import sys
reload(sys) reload(sys)
sys.setdefaultencoding('utf8') sys.setdefaultencoding('utf8')
@ -16,11 +20,13 @@ from vnpy.trader.uiQt import createQApp
from vnpy.trader.uiMainWindow import MainWindow from vnpy.trader.uiMainWindow import MainWindow
# 加载底层接口 # 加载底层接口
from vnpy.trader.gateway import (ctpGateway, oandaGateway, from vnpy.trader.gateway import (ctpGateway, oandaGateway,
ibGateway) ibGateway)
if system == 'Windows': if system == 'Linux':
from vnpy.trader.gateway import (femasGateway, xspeedGateway, from vnpy.trader.gateway import xtpGateway
elif system == 'Windows':
from vnpy.trader.gateway import (femasGateway, xspeedGateway,
futuGateway, secGateway) futuGateway, secGateway)
# 加载上层应用 # 加载上层应用
@ -32,36 +38,36 @@ def main():
"""主程序入口""" """主程序入口"""
# 创建Qt应用对象 # 创建Qt应用对象
qApp = createQApp() qApp = createQApp()
# 创建事件引擎 # 创建事件引擎
ee = EventEngine() ee = EventEngine()
# 创建主引擎 # 创建主引擎
me = MainEngine(ee) me = MainEngine(ee)
# 添加交易接口 # 添加交易接口
me.addGateway(ctpGateway) me.addGateway(ctpGateway)
me.addGateway(oandaGateway) me.addGateway(oandaGateway)
me.addGateway(ibGateway) me.addGateway(ibGateway)
if system == 'Windows': if system == 'Windows':
me.addGateway(femasGateway) me.addGateway(femasGateway)
me.addGateway(xspeedGateway) me.addGateway(xspeedGateway)
me.addGateway(secGateway) me.addGateway(secGateway)
me.addGateway(futuGateway) me.addGateway(futuGateway)
if system == 'Linux': if system == 'Linux':
me.addGateway(xtpGateway) me.addGateway(xtpGateway)
# 添加上层应用 # 添加上层应用
me.addApp(riskManager) me.addApp(riskManager)
me.addApp(ctaStrategy) me.addApp(ctaStrategy)
me.addApp(spreadTrading) me.addApp(spreadTrading)
# 创建主窗口 # 创建主窗口
mw = MainWindow(me, ee) mw = MainWindow(me, ee)
mw.showMaximized() mw.showMaximized()
# 在主线程中启动Qt事件循环 # 在主线程中启动Qt事件循环
sys.exit(qApp.exec_()) sys.exit(qApp.exec_())