[Fix]Close #995
This commit is contained in:
parent
438bab3fff
commit
1d5d7af64b
@ -87,9 +87,6 @@ class BitmexGateway(VtGateway):
|
|||||||
self.restApi.connect(apiKey, apiSecret, sessionCount)
|
self.restApi.connect(apiKey, apiSecret, sessionCount)
|
||||||
self.wsApi.connect(apiKey, apiSecret, symbols)
|
self.wsApi.connect(apiKey, apiSecret, symbols)
|
||||||
|
|
||||||
# 初始化并启动查询
|
|
||||||
#self.initQuery()
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def subscribe(self, subscribeReq):
|
def subscribe(self, subscribeReq):
|
||||||
"""订阅行情"""
|
"""订阅行情"""
|
||||||
|
@ -488,7 +488,11 @@ class CcxtApi(object):
|
|||||||
tick.lowPrice = float(data['low'])
|
tick.lowPrice = float(data['low'])
|
||||||
tick.lastPrice = float(data['close'])
|
tick.lastPrice = float(data['close'])
|
||||||
tick.volume = float(data['quoteVolume'])
|
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.date = tick.datetime.strftime('%Y%m%d')
|
||||||
tick.time = tick.datetime.strftime('%H:%M:%S')
|
tick.time = tick.datetime.strftime('%H:%M:%S')
|
||||||
|
|
||||||
@ -509,8 +513,11 @@ class CcxtApi(object):
|
|||||||
for n, ask in enumerate(data['asks'][:5]):
|
for n, ask in enumerate(data['asks'][:5]):
|
||||||
tick.__setattr__('askPrice%s' %(n+1), float(ask[0]))
|
tick.__setattr__('askPrice%s' %(n+1), float(ask[0]))
|
||||||
tick.__setattr__('askVolume%s' %(n+1), float(ask[1]))
|
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.date = tick.datetime.strftime('%Y%m%d')
|
||||||
tick.time = tick.datetime.strftime('%H:%M:%S')
|
tick.time = tick.datetime.strftime('%H:%M:%S')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user