diff --git a/.gitignore b/.gitignore index dc3e78ec..5822aacd 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,7 @@ Release/ *.con # visual studio -*.opensdf \ No newline at end of file +*.opensdf + +# 本地持久化文件 +*.vn \ No newline at end of file diff --git a/README.md b/README.md index 9926cfc2..628030de 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # vn.py 基于python的开源交易平台开发框架 +## vn.py框架交流群 +QQ群号:262656087 + +相关问题在这个里面问的答复最快。 + ## 2015/4/24项目状态## 发布了基于vn.ctp的Demo,在vn.demo/ctpdemo文件夹下,可用于CTP柜台期货公司的手动交易。 diff --git a/vn.demo/ltsdemo/demoApi.py b/vn.demo/ltsdemo/demoApi.py index 4f62d44e..b03d1cd4 100644 --- a/vn.demo/ltsdemo/demoApi.py +++ b/vn.demo/ltsdemo/demoApi.py @@ -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): diff --git a/vn.demo/ltsdemo/demoEngine.py b/vn.demo/ltsdemo/demoEngine.py index e05a0c8f..53e2a331 100644 --- a/vn.demo/ltsdemo/demoEngine.py +++ b/vn.demo/ltsdemo/demoEngine.py @@ -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): diff --git a/vn.demo/ltsdemo/demoUi.py b/vn.demo/ltsdemo/demoUi.py index 2bb1b0bf..c4685ce3 100644 --- a/vn.demo/ltsdemo/demoUi.py +++ b/vn.demo/ltsdemo/demoUi.py @@ -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()) diff --git a/vn.demo/ltsdemo/exe/demoMain.exe b/vn.demo/ltsdemo/exe/demoMain.exe index 16c3bfc0..635c5d06 100644 Binary files a/vn.demo/ltsdemo/exe/demoMain.exe and b/vn.demo/ltsdemo/exe/demoMain.exe differ