diff --git a/.gitignore b/.gitignore index e7e6a00a..1917a8d0 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,7 @@ build/Makefile .python-version .gitignore temp/ +.venv # setup.py install 临时文件 dist diff --git a/tests/Promise.py b/tests/Promise.py index 2e37d7f0..cae5cc57 100644 --- a/tests/Promise.py +++ b/tests/Promise.py @@ -30,7 +30,7 @@ class Promise(object): raise res[1] else: et, ev, tb = res[1] - raise et, ev, tb + raise et(ev).with_traceback(tb) def set_exception(self, valueOrType, val=None, tb=None): if val is None: diff --git a/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py b/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py index 95745adb..855efcf9 100644 --- a/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py +++ b/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py @@ -6,6 +6,7 @@ from __future__ import print_function +import logging import os import json import hashlib @@ -469,7 +470,7 @@ class BitmexWebsocketApi(WebsocketClient): e.errorMsg = exceptionValue self.gateway.onError(e) - traceback.print_exc() + sys.stderr.write(self.exceptionDetail(exceptionType, exceptionValue, tb)) #---------------------------------------------------------------------- def writeLog(self, content): @@ -573,8 +574,9 @@ class BitmexWebsocketApi(WebsocketClient): trade.tradeID = tradeID trade.vtTradeID = '.'.join([trade.gatewayName, trade.tradeID]) - if 'side' not in d: - print('no side : \n', d) + # bug check: + if d['side'] not in directionMapReverse: + logging.debug('trade wthout side : %s', d) return trade.direction = directionMapReverse[d['side']] diff --git a/vnpy/trader/vtEngine.py b/vnpy/trader/vtEngine.py index 489a6dfd..63499977 100644 --- a/vnpy/trader/vtEngine.py +++ b/vnpy/trader/vtEngine.py @@ -413,7 +413,7 @@ class DataEngine(object): self.workingOrderDict = {} # 可撤销委托 self.tradeDict = {} self.accountDict = {} - self.positionDict= {} + self.positionDict = {} self.logList = [] self.errorList = []