This commit is contained in:
msincenselee 2015-11-09 21:25:32 +08:00
parent d009a5deb5
commit 01d9f9e876
7 changed files with 20 additions and 147 deletions

View File

@ -1,19 +1,7 @@
{
"brokerID": "9999",
"tdAddress": "tcp://180.168.146.187:10000",
<<<<<<< HEAD
<<<<<<< HEAD
"password": "19890624",
"mdAddress": "tcp://180.168.212.228:41213",
"userID": "000300"
=======
"password": "simnow申请",
"mdAddress": "tcp://180.168.212.228:41213",
"userID": "simnow申请"
>>>>>>> refs/remotes/vnpy/master
=======
"password": "simnow申请",
"mdAddress": "tcp://180.168.212.228:41213",
"userID": "simnow申请"
>>>>>>> refs/remotes/vnpy/master
"password": "jiajia",
"mdAddress": "tcp://180.168.146.187:10010",
"userID": "033513"
}

View File

@ -4,20 +4,9 @@
"qryAddress": "tcp://211.144.195.163:54506",
"mdAddress": "tcp://211.144.195.163:54513",
"productInfo": "LTS-Test",
"authCode": "N3EHKP4CYHZGM9VJ",
<<<<<<< HEAD
<<<<<<< HEAD
"authCode": "N3EHKP4CYHZGM9VJ",
"tdPassword": "150601",
"mdPassword": "123",
"userID": "020090002037"
=======
"tdPassword": "华宝证券申请",
"mdPassword": "华宝证券申请",
"userID": "华宝证券申请"
>>>>>>> refs/remotes/vnpy/master
=======
"tdPassword": "华宝证券申请",
"mdPassword": "华宝证券申请",
"userID": "华宝证券申请"
>>>>>>> refs/remotes/vnpy/master
}

View File

@ -384,21 +384,12 @@ class CtpMdApi(MdApi):
#----------------------------------------------------------------------
def subscribe(self, subscribeReq):
"""订阅合约"""
<<<<<<< HEAD
<<<<<<< HEAD
self.subscribeMarketData(str(subscribeReq.symbol))
=======
=======
>>>>>>> refs/remotes/vnpy/master
# 这里的设计是,如果尚未登录就调用了订阅方法
# 则先保存订阅请求,登录完成后会自动订阅
if self.loginStatus:
self.subscribeMarketData(str(subscribeReq.symbol))
<<<<<<< HEAD
>>>>>>> refs/remotes/vnpy/master
=======
>>>>>>> refs/remotes/vnpy/master
self.subscribedSymbols.add(subscribeReq)
self.subscribedSymbols.add(subscribeReq)
#----------------------------------------------------------------------
def login(self):

View File

@ -393,21 +393,13 @@ class LtsMdApi(MdApi):
req = {}
req['InstrumentID'] = str(subscribeReq.symbol)
req['ExchangeID'] = str(subscribeReq.exchange)
<<<<<<< HEAD
<<<<<<< HEAD
self.subscribeMarketData(req)
=======
=======
>>>>>>> refs/remotes/vnpy/master
# 这里的设计是,如果尚未登录就调用了订阅方法
# 则先保存订阅请求,登录完成后会自动订阅
if self.loginStatus:
self.subscribeMarketData(req)
<<<<<<< HEAD
>>>>>>> refs/remotes/vnpy/master
=======
>>>>>>> refs/remotes/vnpy/master
self.subscribedSymbols.add(subscribeReq)
@ -579,16 +571,7 @@ class LtsTdApi(TdApi):
#----------------------------------------------------------------------
def onRtnOrder(self, data):
"""报单回报"""
<<<<<<< HEAD
<<<<<<< HEAD
print '-'*20
for k, v in data.items():
print k, ':', v
=======
>>>>>>> refs/remotes/vnpy/master
=======
>>>>>>> refs/remotes/vnpy/master
# 更新最大报单编号
newref = data['OrderRef']
self.orderRef = max(self.orderRef, int(newref))
@ -682,16 +665,11 @@ class LtsTdApi(TdApi):
#----------------------------------------------------------------------
def onErrRtnOrderInsert(self, data, error):
"""发单错误回报(交易所)"""
<<<<<<< HEAD
<<<<<<< HEAD
print '-'*20
for k, v in data.items():
print k, ':', v
=======
>>>>>>> refs/remotes/vnpy/master
=======
>>>>>>> refs/remotes/vnpy/master
#print '-'*20
#for k, v in data.items():
# print k, ':', v
err = VtErrorData()
err.gatewayName = self.gatewayName
err.errorID = error['ErrorID']

View File

@ -12,14 +12,7 @@ DIRECTION_LONG = u'多'
DIRECTION_SHORT = u''
DIRECTION_UNKNOWN = u'未知'
DIRECTION_NET = u''
<<<<<<< HEAD
<<<<<<< HEAD
=======
DIRECTION_SELL = u'卖出' # IB接口
>>>>>>> refs/remotes/vnpy/master
=======
DIRECTION_SELL = u'卖出' # IB接口
>>>>>>> refs/remotes/vnpy/master
# 开平常量
OFFSET_NONE = u'无开平'
@ -42,14 +35,7 @@ PRODUCT_FUTURES = u'期货'
PRODUCT_OPTION = u'期权'
PRODUCT_INDEX = u'指数'
PRODUCT_COMBINATION = u'组合'
<<<<<<< HEAD
<<<<<<< HEAD
=======
PRODUCT_FOREX = u'外汇'
>>>>>>> refs/remotes/vnpy/master
=======
PRODUCT_FOREX = u'外汇'
>>>>>>> refs/remotes/vnpy/master
PRODUCT_UNKNOWN = u'未知'
# 价格类型常量
@ -69,14 +55,6 @@ EXCHANGE_CFFEX = u'CFFEX' # 中金所
EXCHANGE_SHFE = u'SHFE' # 上期所
EXCHANGE_CZCE = u'CZCE' # 郑商所
EXCHANGE_DCE = u'DCE' # 大商所
<<<<<<< HEAD
<<<<<<< HEAD
EXCHANGE_UNKNOWN = 'UNKNOWN'# 未知交易所
EXCHANGE_NONE = '' # 空交易所
=======
=======
>>>>>>> refs/remotes/vnpy/master
EXCHANGE_UNKNOWN = 'UNKNOWN'# 未知交易所
EXCHANGE_NONE = '' # 空交易所
@ -87,9 +65,4 @@ EXCHANGE_IDEALPRO = u'IDEALPRO' # IB外汇ECN
# 货币类型
CURRENCY_USD = 'USD' # 美元
CURRENCY_CNY = 'CNY' # 人民币
<<<<<<< HEAD
CURRENCY_UNKNOWN = 'UNKNOWN' # 未知货币
>>>>>>> refs/remotes/vnpy/master
=======
CURRENCY_UNKNOWN = 'UNKNOWN' # 未知货币
>>>>>>> refs/remotes/vnpy/master

View File

@ -1,14 +1,7 @@
# encoding: UTF-8
import shelve
<<<<<<< HEAD
<<<<<<< HEAD
=======
from collections import OrderedDict
>>>>>>> refs/remotes/vnpy/master
=======
from collections import OrderedDict
>>>>>>> refs/remotes/vnpy/master
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
@ -16,23 +9,11 @@ from pymongo.errors import ConnectionFailure
from eventEngine import *
from ctpGateway import CtpGateway
from ltsGateway import LtsGateway
<<<<<<< HEAD
<<<<<<< HEAD
from windGateway import WindGateway
from vtGateway import *
import uiBasicWidget
=======
=======
>>>>>>> refs/remotes/vnpy/master
#from windGateway import WindGateway
from ibGateway import IbGateway
from vtGateway import *
import uiBasicWidget
from ctaEngine import CtaEngine
<<<<<<< HEAD
>>>>>>> refs/remotes/vnpy/master
=======
>>>>>>> refs/remotes/vnpy/master
########################################################################
@ -61,25 +42,14 @@ class MainEngine(object):
self.gatewayDict['LTS'].setQryEnabled(True)
#self.addGateway(WindGateway, 'Wind') # 没有Wind的请注释掉这一行
<<<<<<< HEAD
<<<<<<< HEAD
# MongoDB数据库相关
self.dbClient = None # MongoDB客户端对象
=======
=======
>>>>>>> refs/remotes/vnpy/master
self.addGateway(IbGateway, 'IB')
# MongoDB数据库相关
self.dbClient = None # MongoDB客户端对象
# CTA引擎
self.ctaEngine = CtaEngine(self, self.eventEngine, self.dataEngine)
<<<<<<< HEAD
>>>>>>> refs/remotes/vnpy/master
=======
>>>>>>> refs/remotes/vnpy/master
#----------------------------------------------------------------------
def addGateway(self, gateway, gatewayName=None):
@ -94,14 +64,7 @@ class MainEngine(object):
gateway.connect()
else:
self.writeLog(u'接口不存在:%s' %gatewayName)
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> refs/remotes/vnpy/master
>>>>>>> refs/remotes/vnpy/master
#----------------------------------------------------------------------
def subscribe(self, subscribeReq, gatewayName):
"""订阅特定接口的行情"""

View File

@ -395,23 +395,14 @@ class VtOrderReq:
self.priceType = EMPTY_STRING # 价格类型
self.direction = EMPTY_STRING # 买卖
self.offset = EMPTY_STRING # 开平
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> refs/remotes/vnpy/master
# 以下为IB相关
self.productClass = EMPTY_UNICODE # 合约类型
self.currency = EMPTY_STRING # 合约货币
self.expiry = EMPTY_STRING # 到期日
self.strikePrice = EMPTY_FLOAT # 行权价
self.optionType = EMPTY_UNICODE # 期权类型
<<<<<<< HEAD
>>>>>>> refs/remotes/vnpy/master
=======
>>>>>>> refs/remotes/vnpy/master
########################################################################
class VtCancelOrderReq: