Merge pull request #1076 from studynon/dev

[Mod]gateway相关的python3兼容性修改
This commit is contained in:
vn.py 2018-08-29 12:59:34 +08:00 committed by GitHub
commit 4f2e04c776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 73 additions and 46 deletions

View File

@ -46,7 +46,7 @@ class CoincheckGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -56,6 +56,7 @@ class CoincheckGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
accessKey = str(setting['accessKey']) accessKey = str(setting['accessKey'])
secretKey = str(setting['secretKey']) secretKey = str(setting['secretKey'])

View File

@ -47,7 +47,7 @@ class korbitGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -57,6 +57,7 @@ class korbitGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
self.accountID = str(setting["accountID"]) self.accountID = str(setting["accountID"])
self.accessKey = str(setting['accessKey']) self.accessKey = str(setting['accessKey'])

View File

@ -65,7 +65,7 @@ class zbGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -75,6 +75,7 @@ class zbGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
secretKey = str(setting['secretKey']) secretKey = str(setting['secretKey'])

View File

@ -96,7 +96,7 @@ class TkproGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -105,6 +105,7 @@ class TkproGateway(VtGateway):
return return
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
username = str(setting['username']) username = str(setting['username'])
token = str(setting['token']) token = str(setting['token'])

View File

@ -52,7 +52,7 @@ class BigoneGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -62,6 +62,7 @@ class BigoneGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
apiSecret = str(setting['apiSecret']) apiSecret = str(setting['apiSecret'])

View File

@ -68,7 +68,7 @@ class BinanceGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -78,6 +78,7 @@ class BinanceGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
secretKey = str(setting['secretKey']) secretKey = str(setting['secretKey'])

View File

@ -51,7 +51,7 @@ class BitfinexGateay(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -61,6 +61,7 @@ class BitfinexGateay(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
secretKey = str(setting['secretKey']) secretKey = str(setting['secretKey'])

View File

@ -78,7 +78,7 @@ class BithumbGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -88,6 +88,7 @@ class BithumbGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
apiSecret = str(setting['apiSecret']) apiSecret = str(setting['apiSecret'])

View File

@ -61,7 +61,7 @@ class BitmexGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -71,6 +71,7 @@ class BitmexGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
apiSecret = str(setting['apiSecret']) apiSecret = str(setting['apiSecret'])

View File

@ -59,7 +59,7 @@ class CcxtGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -69,6 +69,7 @@ class CcxtGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
exchange = str(setting['exchange']) exchange = str(setting['exchange'])
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])

View File

@ -58,7 +58,7 @@ class CoinbaseGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -68,6 +68,7 @@ class CoinbaseGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
secretKey = str(setting['secretKey']) secretKey = str(setting['secretKey'])

View File

@ -104,7 +104,7 @@ class CshshlpGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -114,6 +114,7 @@ class CshshlpGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
userID = str(setting['userID']) userID = str(setting['userID'])

View File

@ -60,7 +60,7 @@ class FcoinGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -70,6 +70,7 @@ class FcoinGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
apiSecret = str(setting['apiSecret']) apiSecret = str(setting['apiSecret'])

View File

@ -81,7 +81,7 @@ class FemasGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -91,6 +91,7 @@ class FemasGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
userID = str(setting['userID']) userID = str(setting['userID'])
password = str(setting['password']) password = str(setting['password'])

View File

@ -61,7 +61,7 @@ class FxcmGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -71,6 +71,7 @@ class FxcmGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
port = int(setting['port']) port = int(setting['port'])
url = str(setting['url']) url = str(setting['url'])

View File

@ -149,7 +149,7 @@ class IbGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -159,6 +159,7 @@ class IbGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
self.host = str(setting['host']) self.host = str(setting['host'])
self.port = int(setting['port']) self.port = int(setting['port'])

View File

@ -54,7 +54,7 @@ class KsgoldGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -64,6 +64,7 @@ class KsgoldGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
accountID = str(setting['accountID']) accountID = str(setting['accountID'])
password = str(setting['password']) password = str(setting['password'])

View File

@ -76,7 +76,7 @@ class KsotpGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -86,6 +86,7 @@ class KsotpGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
userID = str(setting['userID']) userID = str(setting['userID'])
password = str(setting['password']) password = str(setting['password'])

View File

@ -50,7 +50,7 @@ class LbankGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -60,6 +60,7 @@ class LbankGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
secretKey = str(setting['secretKey']) secretKey = str(setting['secretKey'])

View File

@ -78,7 +78,7 @@ class LtsGateway(VtGateway):
"""连接""" """连接"""
# 载入json 文件 # 载入json 文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -88,6 +88,7 @@ class LtsGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
userID = str(setting['userID']) userID = str(setting['userID'])
mdPassword = str(setting['mdPassword']) mdPassword = str(setting['mdPassword'])

View File

@ -63,7 +63,7 @@ class OkexGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -73,6 +73,7 @@ class OkexGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
apiKey = str(setting['apiKey']) apiKey = str(setting['apiKey'])
secretKey = str(setting['secretKey']) secretKey = str(setting['secretKey'])

View File

@ -85,7 +85,7 @@ class QdpGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -95,6 +95,7 @@ class QdpGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
userID = str(setting['userID']) userID = str(setting['userID'])
password = str(setting['password']) password = str(setting['password'])

View File

@ -82,7 +82,7 @@ class SecGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -92,6 +92,7 @@ class SecGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
accountID = str(setting['accountID']) accountID = str(setting['accountID'])
password = str(setting['password']) password = str(setting['password'])

View File

@ -96,7 +96,7 @@ class SgitGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -106,6 +106,7 @@ class SgitGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
userID = str(setting['userID']) userID = str(setting['userID'])
password = str(setting['password']) password = str(setting['password'])

View File

@ -77,7 +77,7 @@ class ShzdGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -87,6 +87,7 @@ class ShzdGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
frontAddress = str(setting['frontAddress']) frontAddress = str(setting['frontAddress'])
frontPort = int(setting['frontPort']) frontPort = int(setting['frontPort'])

View File

@ -86,7 +86,7 @@ class XspeedGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -96,6 +96,7 @@ class XspeedGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
accountID = str(setting['accountID']) accountID = str(setting['accountID'])
password = str(setting['password']) password = str(setting['password'])

View File

@ -111,7 +111,7 @@ class XtpGateway(VtGateway):
def connect(self): def connect(self):
"""连接""" """连接"""
try: try:
f = file(self.filePath) f = open(self.filePath)
except IOError: except IOError:
log = VtLogData() log = VtLogData()
log.gatewayName = self.gatewayName log.gatewayName = self.gatewayName
@ -121,6 +121,7 @@ class XtpGateway(VtGateway):
# 解析json文件 # 解析json文件
setting = json.load(f) setting = json.load(f)
f.close()
try: try:
userID = str(setting['userID']) userID = str(setting['userID'])
password = str(setting['password']) password = str(setting['password'])