This commit is contained in:
vn.py 2018-08-04 22:05:24 +08:00
parent 438bab3fff
commit 1d5d7af64b
2 changed files with 10 additions and 6 deletions

View File

@ -87,9 +87,6 @@ class BitmexGateway(VtGateway):
self.restApi.connect(apiKey, apiSecret, sessionCount)
self.wsApi.connect(apiKey, apiSecret, symbols)
# 初始化并启动查询
#self.initQuery()
#----------------------------------------------------------------------
def subscribe(self, subscribeReq):
"""订阅行情"""

View File

@ -488,7 +488,11 @@ class CcxtApi(object):
tick.lowPrice = float(data['low'])
tick.lastPrice = float(data['close'])
tick.volume = float(data['quoteVolume'])
tick.datetime = datetime.fromtimestamp(data['timestamp']/1000)
if data['timestamp']:
tick.datetime = datetime.fromtimestamp(data['timestamp']/1000)
else:
tick.datetime = datetime.now()
tick.date = tick.datetime.strftime('%Y%m%d')
tick.time = tick.datetime.strftime('%H:%M:%S')
@ -510,7 +514,10 @@ class CcxtApi(object):
tick.__setattr__('askPrice%s' %(n+1), float(ask[0]))
tick.__setattr__('askVolume%s' %(n+1), float(ask[1]))
tick.datetime = datetime.fromtimestamp(data['timestamp']/1000)
if data['timestamp']:
tick.datetime = datetime.fromtimestamp(data['timestamp']/1000)
else:
tick.datetime = datetime.now()
tick.date = tick.datetime.strftime('%Y%m%d')
tick.time = tick.datetime.strftime('%H:%M:%S')