Skip to content

Commit

Permalink
Merge pull request vnpy#898 from cclauss/modernize-vnpy_api_shzd
Browse files Browse the repository at this point in the history
Modernize vnpy/api/shzd
  • Loading branch information
vnpy authored May 30, 2018
2 parents 481797c + 6f91673 commit 3cc2a9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion vnpy/api/shzd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: UTF-8

from vnshzd import ShzdApi
from __future__ import absolute_import
from .vnshzd import ShzdApi
17 changes: 9 additions & 8 deletions vnpy/api/shzd/test/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# encoding: UTF-8

from __future__ import print_function
from time import sleep

from vnshzd import *
Expand All @@ -10,7 +11,7 @@ def printDict(d):
l = d.keys()
l.sort()
for key in l:
print '%s:%s' %(key, d[key])
print('%s:%s' %(key, d[key]))


########################################################################
Expand All @@ -26,19 +27,19 @@ def __init__(self):
#----------------------------------------------------------------------
def onReceiveErrorInfo(self, errcode, errmsg):
""""""
print '-' * 50
print 'errorcode %s, error msg %s' %(errcode, errmsg)
print('-' * 50)
print('errorcode %s, error msg %s' %(errcode, errmsg))

#----------------------------------------------------------------------
def onReceiveMarketInfo(self, data):
""""""
print '-' * 50
print('-' * 50)
printDict(data)

#----------------------------------------------------------------------
def onReceiveTradeInfo(self, data):
""""""
print '-' * 50
print('-' * 50)
printDict(data)

if __name__ == '__main__':
Expand All @@ -49,8 +50,8 @@ def onReceiveTradeInfo(self, data):
api.initShZdServer()

# 注册前置机地址
print api.registerFront('222.73.119.230', 7003)
print api.registerMarket('222.73.119.230', 9003)
print(api.registerFront('222.73.119.230', 7003))
print(api.registerMarket('222.73.119.230', 9003))

# 登录
sleep(1)
Expand All @@ -68,7 +69,7 @@ def onReceiveTradeInfo(self, data):
data['201'] = '+'
#data['307'] = "CME,6J1609"
data['307'] = 'ICE,WBS1611'
print data
print(data)
api.shzdSendInfoToMarket(data)

# # 查询合约
Expand Down

0 comments on commit 3cc2a9a

Please sign in to comment.