From 541c4b6f764d7104f7ca472cc85a7f32b6e22007 Mon Sep 17 00:00:00 2001 From: nanoric Date: Thu, 1 Nov 2018 22:08:12 -0400 Subject: [PATCH] =?UTF-8?q?[Fix]=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=BD=93bit?= =?UTF-8?q?mexgateway.socketapi=E5=93=8D=E5=BA=94onTrade=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E9=81=87=E5=88=B0side=E5=AD=97=E6=AE=B5=E4=B8=BA''=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=BC=82=E5=B8=B8=E7=9A=84=E6=83=85=E5=86=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit an example without 'size': { 'execID': '***', 'execType': 'Funding', 'ordStatus': 'Filled', 'lastLiquidityInd': '', 'exDestination': 'XBME', 'text': 'Funding', 'lastQty': 508, 'timeInForce': 'AtTheClose', 'currency': 'USD', 'pegPriceType': '', 'simpleLeavesQty': None, 'transactTime': '***', 'ordRejReason': '', 'underlyingLastPx': None, 'execCost': 8051292, 'clOrdID': '', 'settlCurrency': 'XBt', 'cumQty': 508, 'displayQty': None, 'lastPx': 6309.35, 'homeNotional': -0.08051292, 'commission': -0.0001, 'avgPx': 6309.35, 'lastMkt': 'XBME', 'price': 6309.35, 'trdMatchID': '***', 'simpleOrderQty': None, 'contingencyType': '', 'triggered': '', 'timestamp': '***', 'symbol': 'XBTUSD', 'foreignNotional': 508, 'pegOffsetValue': None, 'execInst': '', 'simpleCumQty': None, 'execComm': -805, 'orderID': '***', 'multiLegReportingType': 'SingleSecurity', 'account': ***, 'stopPx': None, 'leavesQty': 0, 'tradePublishIndicator': '', 'orderQty': 508, 'workingIndicator': False, 'ordType': 'Limit', 'clOrdLinkID': '', 'side': '' } --- vnpy/trader/gateway/bitmexGateway/bitmexGateway.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py b/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py index def69c5f..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 @@ -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']]