diff --git a/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py b/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py index a0c87eb6..599ead71 100644 --- a/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py +++ b/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py @@ -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): """订阅行情""" diff --git a/vnpy/trader/gateway/ccxtGateway/ccxtGateway.py b/vnpy/trader/gateway/ccxtGateway/ccxtGateway.py index 2df0e484..5461e304 100644 --- a/vnpy/trader/gateway/ccxtGateway/ccxtGateway.py +++ b/vnpy/trader/gateway/ccxtGateway/ccxtGateway.py @@ -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') @@ -509,8 +513,11 @@ class CcxtApi(object): for n, ask in enumerate(data['asks'][:5]): 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')