commit
4f2e04c776
@ -46,7 +46,7 @@ class CoincheckGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -56,6 +56,7 @@ class CoincheckGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
accessKey = str(setting['accessKey'])
|
||||
secretKey = str(setting['secretKey'])
|
||||
|
@ -47,7 +47,7 @@ class korbitGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -57,6 +57,7 @@ class korbitGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
self.accountID = str(setting["accountID"])
|
||||
self.accessKey = str(setting['accessKey'])
|
||||
@ -584,4 +585,4 @@ class KorbitDataApi(vnkorbit.Korbit_DataApi):
|
||||
dt = datetime.fromtimestamp(float(s)/1e3)
|
||||
time = dt.strftime("%H:%M:%S.%f")
|
||||
date = dt.strftime("%Y%m%d")
|
||||
return dt , date, time
|
||||
return dt , date, time
|
||||
|
@ -65,7 +65,7 @@ class zbGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -75,6 +75,7 @@ class zbGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
secretKey = str(setting['secretKey'])
|
||||
@ -855,4 +856,4 @@ class ZB_API_Spot(ZB_Sub_Spot_Api):
|
||||
time = dt.strftime("%H:%M:%S.%f")
|
||||
date = dt.strftime("%Y%m%d")
|
||||
return date, time
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ class TkproGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -105,6 +105,7 @@ class TkproGateway(VtGateway):
|
||||
return
|
||||
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
username = str(setting['username'])
|
||||
token = str(setting['token'])
|
||||
|
@ -52,7 +52,7 @@ class BigoneGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -62,6 +62,7 @@ class BigoneGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
apiSecret = str(setting['apiSecret'])
|
||||
@ -509,4 +510,4 @@ def printDict(d):
|
||||
l.sort()
|
||||
for k in l:
|
||||
print(k, d[k])
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ class BinanceGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -78,6 +78,7 @@ class BinanceGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
secretKey = str(setting['secretKey'])
|
||||
@ -487,4 +488,4 @@ class GatewayApi(BinanceApi):
|
||||
#----------------------------------------------------------------------
|
||||
def cancel(self, cancelOrderReq):
|
||||
""""""
|
||||
self.cancelOrder(cancelOrderReq.symbol, origClientOrderId=cancelOrderReq.orderID)
|
||||
self.cancelOrder(cancelOrderReq.symbol, origClientOrderId=cancelOrderReq.orderID)
|
||||
|
@ -51,7 +51,7 @@ class BitfinexGateay(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -61,6 +61,7 @@ class BitfinexGateay(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
secretKey = str(setting['secretKey'])
|
||||
|
@ -78,7 +78,7 @@ class BithumbGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -88,6 +88,7 @@ class BithumbGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
apiSecret = str(setting['apiSecret'])
|
||||
|
@ -61,7 +61,7 @@ class BitmexGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -71,6 +71,7 @@ class BitmexGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
apiSecret = str(setting['apiSecret'])
|
||||
@ -531,4 +532,4 @@ def printDict(d):
|
||||
l.sort()
|
||||
for k in l:
|
||||
print(k, d[k])
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ class CcxtGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -69,6 +69,7 @@ class CcxtGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
exchange = str(setting['exchange'])
|
||||
apiKey = str(setting['apiKey'])
|
||||
@ -544,4 +545,4 @@ class CcxtApi(object):
|
||||
""""""
|
||||
self.qryDepth()
|
||||
self.qryTicker()
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ class CoinbaseGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -68,6 +68,7 @@ class CoinbaseGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
secretKey = str(setting['secretKey'])
|
||||
@ -661,4 +662,4 @@ def printDict(d):
|
||||
l.sort()
|
||||
for k in l:
|
||||
print(k, d[k])
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ class CshshlpGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -114,6 +114,7 @@ class CshshlpGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
|
||||
try:
|
||||
userID = str(setting['userID'])
|
||||
|
@ -60,7 +60,7 @@ class FcoinGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -70,6 +70,7 @@ class FcoinGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
apiSecret = str(setting['apiSecret'])
|
||||
@ -579,4 +580,4 @@ def printDict(d):
|
||||
l.sort()
|
||||
for k in l:
|
||||
print(k, d[k])
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ class FemasGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -91,6 +91,7 @@ class FemasGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
userID = str(setting['userID'])
|
||||
password = str(setting['password'])
|
||||
@ -944,4 +945,4 @@ class FemasTdApi(TdApi):
|
||||
#----------------------------------------------------------------------
|
||||
def onRspQryInvestorMargin(self, data, error, n, last):
|
||||
""""""
|
||||
pass
|
||||
pass
|
||||
|
@ -61,7 +61,7 @@ class FxcmGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -71,6 +71,7 @@ class FxcmGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
port = int(setting['port'])
|
||||
url = str(setting['url'])
|
||||
@ -564,4 +565,4 @@ def getTime(s):
|
||||
|
||||
t = ':'.join([hour, minute, second])
|
||||
d = ''.join([year, month, day])
|
||||
return d, t
|
||||
return d, t
|
||||
|
@ -149,7 +149,7 @@ class IbGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -159,6 +159,7 @@ class IbGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
self.host = str(setting['host'])
|
||||
self.port = int(setting['port'])
|
||||
@ -737,4 +738,4 @@ class IbWrapper(IbApi):
|
||||
def softDollarTiers(self, reqId, tiers):
|
||||
""""""
|
||||
pass
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ class KsgoldGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -64,6 +64,7 @@ class KsgoldGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
accountID = str(setting['accountID'])
|
||||
password = str(setting['password'])
|
||||
|
@ -76,7 +76,7 @@ class KsotpGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -86,6 +86,7 @@ class KsotpGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
userID = str(setting['userID'])
|
||||
password = str(setting['password'])
|
||||
|
@ -50,7 +50,7 @@ class LbankGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -60,6 +60,7 @@ class LbankGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
secretKey = str(setting['secretKey'])
|
||||
|
@ -78,7 +78,7 @@ class LtsGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json 文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -88,6 +88,7 @@ class LtsGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
userID = str(setting['userID'])
|
||||
mdPassword = str(setting['mdPassword'])
|
||||
@ -1239,4 +1240,4 @@ class LtsQryApi(QryApi):
|
||||
self.exit()
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ class OkexGateway(VtGateway):
|
||||
"""连接"""
|
||||
# 载入json文件
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -73,6 +73,7 @@ class OkexGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
apiKey = str(setting['apiKey'])
|
||||
secretKey = str(setting['secretKey'])
|
||||
@ -628,4 +629,4 @@ class SpotApi(OkexSpotApi):
|
||||
self.subscribeSpotDepth(symbol, 5)
|
||||
self.subSpotOrder(symbol)
|
||||
self.subSpotBalance(symbol)
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ class QdpGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -95,6 +95,7 @@ class QdpGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
userID = str(setting['userID'])
|
||||
password = str(setting['password'])
|
||||
|
@ -82,7 +82,7 @@ class SecGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -92,6 +92,7 @@ class SecGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
accountID = str(setting['accountID'])
|
||||
password = str(setting['password'])
|
||||
@ -1587,4 +1588,4 @@ def checkOptionSymbol(symbol):
|
||||
if len(symbol) > 6:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ class SgitGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -106,6 +106,7 @@ class SgitGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
userID = str(setting['userID'])
|
||||
password = str(setting['password'])
|
||||
@ -1405,4 +1406,4 @@ class PositionBuffer(object):
|
||||
#----------------------------------------------------------------------
|
||||
def getPos(self):
|
||||
"""获取当前的持仓数据"""
|
||||
return copy(self.pos)
|
||||
return copy(self.pos)
|
||||
|
@ -77,7 +77,7 @@ class ShzdGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -87,6 +87,7 @@ class ShzdGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
frontAddress = str(setting['frontAddress'])
|
||||
frontPort = int(setting['frontPort'])
|
||||
@ -727,4 +728,4 @@ def printDict(d):
|
||||
l.sort()
|
||||
for k in l:
|
||||
print(k, ':', d[k])
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ class XspeedGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -96,6 +96,7 @@ class XspeedGateway(VtGateway):
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
accountID = str(setting['accountID'])
|
||||
password = str(setting['password'])
|
||||
@ -1220,4 +1221,4 @@ class XspeedTdApi(TdApi):
|
||||
def onRspEquityComputMode(self, data) :
|
||||
""""""
|
||||
pass
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ class XtpGateway(VtGateway):
|
||||
def connect(self):
|
||||
"""连接"""
|
||||
try:
|
||||
f = file(self.filePath)
|
||||
f = open(self.filePath)
|
||||
except IOError:
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
@ -120,7 +120,8 @@ class XtpGateway(VtGateway):
|
||||
return
|
||||
|
||||
# 解析json文件
|
||||
setting = json.load(f)
|
||||
setting = json.load(f)
|
||||
f.close()
|
||||
try:
|
||||
userID = str(setting['userID'])
|
||||
password = str(setting['password'])
|
||||
@ -823,4 +824,4 @@ class XtpTdApi(TraderApi):
|
||||
log = VtLogData()
|
||||
log.gatewayName = self.gatewayName
|
||||
log.logContent = content
|
||||
self.gateway.onLog(log)
|
||||
self.gateway.onLog(log)
|
||||
|
Loading…
Reference in New Issue
Block a user