Merge pull request #1207 from nanoric/fix_bitemex_onTrade_error_without_side

[Fix] 修复了当bitmexgateway.socketapi响应onTrade时,遇到side字段为''导致异常的情况。
This commit is contained in:
vn.py 2018-11-05 09:01:28 +08:00 committed by GitHub
commit 8baad896a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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']]