LTSDEMO加入了登录时,行情和交易使用不同密码的功能
This commit is contained in:
parent
da1fb95ebf
commit
e851cf8a76
5
.gitignore
vendored
5
.gitignore
vendored
@ -25,4 +25,7 @@ Release/
|
||||
*.con
|
||||
|
||||
# visual studio
|
||||
*.opensdf
|
||||
*.opensdf
|
||||
|
||||
# 本地持久化文件
|
||||
*.vn
|
@ -1,6 +1,11 @@
|
||||
# vn.py
|
||||
基于python的开源交易平台开发框架
|
||||
|
||||
## vn.py框架交流群
|
||||
QQ群号:262656087
|
||||
|
||||
相关问题在这个里面问的答复最快。
|
||||
|
||||
## 2015/4/24项目状态##
|
||||
发布了基于vn.ctp的Demo,在vn.demo/ctpdemo文件夹下,可用于CTP柜台期货公司的手动交易。
|
||||
|
||||
|
@ -54,7 +54,7 @@ class DemoMdApi(MdApi):
|
||||
self.__setSubscribed = set()
|
||||
|
||||
# 初始化.con文件的保存目录为\mdconnection,注意这个目录必须已存在,否则会报错
|
||||
self.createFtdcMdApi(os.getcwd() + '\\mdconnection\\')
|
||||
self.createFtdcMdApi(os.getcwd() + '\\mdconnection\\')
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onFrontConnected(self):
|
||||
|
@ -44,10 +44,10 @@ class MainEngine:
|
||||
self.ee.register(EVENT_INSTRUMENT, self.insertInstrument)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def login(self, userid, password, brokerid, mdAddress, tdAddress):
|
||||
def login(self, userid, mdPassword, tdPassword, brokerid, mdAddress, tdAddress):
|
||||
"""登陆"""
|
||||
self.md.login(mdAddress, userid, password, brokerid)
|
||||
self.td.login(tdAddress, userid, password, brokerid)
|
||||
self.md.login(mdAddress, userid, mdPassword, brokerid)
|
||||
self.td.login(tdAddress, userid, tdPassword, brokerid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def subscribe(self, instrumentid, exchangeid):
|
||||
|
@ -450,7 +450,7 @@ class OrderMonitor(QtGui.QTableWidget):
|
||||
|
||||
self.dictOrderData[orderref] = data
|
||||
|
||||
# 如果之前已经收到过这个账户的数据, 则直接更新
|
||||
# 如果之前已经收到过这个订单的数据, 则直接更新
|
||||
if orderref in self.dictOrder:
|
||||
d = self.dictOrder[orderref]
|
||||
|
||||
@ -646,12 +646,14 @@ class LoginWidget(QtGui.QDialog):
|
||||
|
||||
# 设置组件
|
||||
labelUserID = QtGui.QLabel(u'账号:')
|
||||
labelPassword = QtGui.QLabel(u'密码:')
|
||||
labelMdPassword = QtGui.QLabel(u'行情密码:')
|
||||
labelTdPassword = QtGui.QLabel(u'交易密码:')
|
||||
labelMdAddress = QtGui.QLabel(u'行情服务器:')
|
||||
labelTdAddress = QtGui.QLabel(u'交易服务器:')
|
||||
|
||||
self.editUserID = QtGui.QLineEdit()
|
||||
self.editPassword = QtGui.QLineEdit()
|
||||
self.editMdPassword = QtGui.QLineEdit()
|
||||
self.editTdPassword = QtGui.QLineEdit()
|
||||
self.editMdAddress = QtGui.QLineEdit()
|
||||
self.editTdAddress = QtGui.QLineEdit()
|
||||
|
||||
@ -670,14 +672,16 @@ class LoginWidget(QtGui.QDialog):
|
||||
|
||||
grid = QtGui.QGridLayout()
|
||||
grid.addWidget(labelUserID, 0, 0)
|
||||
grid.addWidget(labelPassword, 1, 0)
|
||||
grid.addWidget(labelMdAddress, 2, 0)
|
||||
grid.addWidget(labelTdAddress, 3, 0)
|
||||
grid.addWidget(labelMdPassword, 1, 0)
|
||||
grid.addWidget(labelTdPassword, 2, 0)
|
||||
grid.addWidget(labelMdAddress, 3, 0)
|
||||
grid.addWidget(labelTdAddress, 4, 0)
|
||||
grid.addWidget(self.editUserID, 0, 1)
|
||||
grid.addWidget(self.editPassword, 1, 1)
|
||||
grid.addWidget(self.editMdAddress, 2, 1)
|
||||
grid.addWidget(self.editTdAddress, 3, 1)
|
||||
grid.addLayout(buttonHBox, 4, 0, 1, 2)
|
||||
grid.addWidget(self.editMdPassword, 1, 1)
|
||||
grid.addWidget(self.editTdPassword, 2, 1)
|
||||
grid.addWidget(self.editMdAddress, 3, 1)
|
||||
grid.addWidget(self.editTdAddress, 4, 1)
|
||||
grid.addLayout(buttonHBox, 5, 0, 1, 2)
|
||||
|
||||
self.setLayout(grid)
|
||||
|
||||
@ -685,12 +689,13 @@ class LoginWidget(QtGui.QDialog):
|
||||
def login(self):
|
||||
"""登录"""
|
||||
userid = str(self.editUserID.text())
|
||||
password = str(self.editPassword.text())
|
||||
mdPassword = str(self.editMdPassword.text())
|
||||
tdPassword = str(self.editTdPassword.text())
|
||||
mdAddress = str(self.editMdAddress.text())
|
||||
tdAddress = str(self.editTdAddress.text())
|
||||
brokerid = '2011'
|
||||
|
||||
self.__mainEngine.login(userid, password, brokerid, mdAddress, tdAddress)
|
||||
self.__mainEngine.login(userid, mdPassword, tdPassword, brokerid, mdAddress, tdAddress)
|
||||
self.close()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@ -701,12 +706,14 @@ class LoginWidget(QtGui.QDialog):
|
||||
try:
|
||||
setting = f['login']
|
||||
userid = setting['userid']
|
||||
password = setting['password']
|
||||
mdPassword = setting['mdPassword']
|
||||
tdPassword = setting['tdPassword']
|
||||
mdAddress = setting['mdAddress']
|
||||
tdAddress = setting['tdAddress']
|
||||
|
||||
self.editUserID.setText(userid)
|
||||
self.editPassword.setText(password)
|
||||
self.editMdPassword.setText(mdPassword)
|
||||
self.editTdPassword.setText(tdPassword)
|
||||
self.editMdAddress.setText(mdAddress)
|
||||
self.editTdAddress.setText(tdAddress)
|
||||
except KeyError:
|
||||
@ -719,7 +726,8 @@ class LoginWidget(QtGui.QDialog):
|
||||
"""保存数据"""
|
||||
setting = {}
|
||||
setting['userid'] = str(self.editUserID.text())
|
||||
setting['password'] = str(self.editPassword.text())
|
||||
setting['mdPassword'] = str(self.editMdPassword.text())
|
||||
setting['tdPassword'] = str(self.editTdPassword.text())
|
||||
setting['mdAddress'] = str(self.editMdAddress.text())
|
||||
setting['tdAddress'] = str(self.editTdAddress.text())
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user