完成接口修改

This commit is contained in:
vn.py 2017-06-01 16:40:30 +08:00
parent 016f26a19a
commit 8e5ae0565c
18 changed files with 62 additions and 21 deletions

View File

@ -1 +1 @@
# encoding: UTF-8
# encoding: UTF-8

View File

@ -579,6 +579,11 @@ class CtaEngine(object):
newPrice = round(price/priceTick, 0) * priceTick
return newPrice
#----------------------------------------------------------------------
def stop(self):
"""停止"""
pass
########################################################################

View File

@ -252,3 +252,9 @@ class RmEngine(object):
self.writeRiskLog(u'风险管理功能启动')
else:
self.writeRiskLog(u'风险管理功能停止')
#----------------------------------------------------------------------
def stop(self):
"""停止"""
self.saveSetting()

View File

@ -2,6 +2,6 @@
"brokerID": "9999",
"mdAddress": "tcp://180.168.146.187:10011",
"tdAddress": "tcp://180.168.146.187:10001",
"userID": "simnow申请",
"password": "simnow申请"
"userID": "000300",
"password": "19890624"
}

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from ksgoldGateway import KsgoldGateway as gateway
from ksgoldGateway import KsgoldGateway
gatewayClass = KsgoldGateway
gatewayName = 'KSGOLD'
gatewayDisplayName = u'金仕达黄金'
gatewayType = vtConstant.GATEWAYTYPE_FUTURES

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from ksotpGateway import KsotpGateway as gateway
from ksotpGateway import KsotpGateway
gatewayClass = KsotpGateway
gatewayName = 'KSOTP'
gatewayDisplayName = u'金仕达期权'
gatewayType = vtConstant.GATEWAYTYPE_EQUITY

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from lhangGateway import LhangGateway as gateway
from lhangGateway import LhangGateway
gatewayClass = LhangGateway
gatewayName = 'LHANG'
gatewayDisplayName = u'链行'
gatewayType = vtConstant.GATEWAYTYPE_BTC

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from ltsGateway import LtsGateway as gateway
from ltsGateway import LtsGateway
gatewayClass = LtsGateway
gatewayName = 'LTS'
gatewayDisplayName = gatewayName
gatewayType = vtConstant.GATEWAYTYPE_EQUITY

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from oandaGateway import OandaGateway as gateway
from oandaGateway import OandaGateway
gatewayClass = OandaGateway
gatewayName = 'OANDA'
gatewayDisplayName = gatewayName
gatewayType = vtConstant.GATEWAYTYPE_INTERNATIONAL

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from okcoinGateway import OkcoinGateway as gateway
from okcoinGateway import OkcoinGateway
gatewayClass = OkcoinGateway
gatewayName = 'OKCOIN'
gatewayDisplayName = u'币行'
gatewayType = vtConstant.GATEWAYTYPE_BTC

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from qdpGateway import QdpGateway as gateway
from qdpGateway import QdpGateway
gatewayClass = QdpGateway
gatewayName = 'QDP'
gatewayDisplayName = gatewayName
gatewayType = vtConstant.GATEWAYTYPE_FUTURES

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from sgitGateway import SgitGateway as gateway
from sgitGateway import SgitGateway
gatewayClass = SgitGateway
gatewayName = 'SGIT'
gatewayDisplayName = u'飞鼠'
gatewayType = vtConstant.GATEWAYTYPE_FUTURES

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from shzdGateway import ShzdGateway as gateway
from shzdGateway import ShzdGateway
gatewayClass = ShzdGateway
gatewayName = 'SHZD'
gatewayDisplayName = u'直达'
gatewayType = vtConstant.GATEWAYTYPE_INTERNATIONAL

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from windGateway import WindGateway as gateway
from windGateway import WindGateway
gatewayClass = WindGateway
gatewayName = 'WIND'
gatewayDisplayName = u'万得'
gatewayType = vtConstant.GATEWAYTYPE_DATA

View File

@ -133,7 +133,8 @@ class WindGateway(VtGateway):
#----------------------------------------------------------------------
def close(self):
self.w.stop()
if self.w:
self.w.stop()
#----------------------------------------------------------------------
def registerEvent(self):

View File

@ -1,8 +1,9 @@
# encoding: UTF-8
from vnpy.trader import vtConstant
from xspeedGateway import XspeedGateway as gateway
from xspeedGateway import XspeedGateway
gatewayClass = XspeedGateway
gatewayName = 'XSPEED'
gatewayDisplayName = u'飞创'
gatewayType = vtConstant.GATEWAYTYPE_FUTURES

View File

@ -156,10 +156,11 @@ class MainEngine(object):
gateway.close()
# 停止事件引擎
self.eventEngine.stop()
self.eventEngine.stop()
# 停止数据记录引擎
self.drEngine.stop()
# 停止上层应用引擎
for appEngine in self.appDict.values():
appEngine.stop()
# 保存数据引擎里的合约数据到硬盘
self.dataEngine.saveContracts()

View File

@ -13,9 +13,13 @@ from vnpy.trader.uiQt import qApp
from vnpy.trader.uiMainWindow import MainWindow
# 加载底层接口
from vnpy.trader.gateway import (ctpGateway,
ibGateway,
huobiGateway)
from vnpy.trader.gateway import (ctpGateway, femasGateway, ksotpGateway,
qdpGateway, xspeedGateway,
cshshlpGateway, ltsGateway,
ksgoldGateway, sgitGateway,
oandaGateway, ibGateway, shzdGateway,
huobiGateway, okcoinGateway, lhangGateway,
windGateway)
# 加载上层应用
from vnpy.trader.app import (riskManager, dataRecorder,
@ -33,8 +37,21 @@ def main():
# 添加交易接口
me.addGateway(ctpGateway)
me.addGateway(femasGateway)
me.addGateway(ksotpGateway)
me.addGateway(qdpGateway)
me.addGateway(xspeedGateway)
me.addGateway(cshshlpGateway)
me.addGateway(ltsGateway)
me.addGateway(ksgoldGateway)
me.addGateway(sgitGateway)
me.addGateway(oandaGateway)
me.addGateway(ibGateway)
me.addGateway(shzdGateway)
me.addGateway(huobiGateway)
me.addGateway(okcoinGateway)
me.addGateway(lhangGateway)
me.addGateway(windGateway)
# 添加上层应用
me.addApp(riskManager)