From 49d22b47beed8d94043e4667f1bf5a3ce27b9c66 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 11 Jun 2018 13:06:41 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E5=A2=9E=E5=8A=A0BitfinexGateway=E8=A1=8C?= =?UTF-8?q?=E6=83=85=E6=95=B0=E6=8D=AE=E7=9A=84=E5=BC=BA=E5=88=B6=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway/bitfinexGateway/bitfinexGateway.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/vnpy/trader/gateway/bitfinexGateway/bitfinexGateway.py b/vnpy/trader/gateway/bitfinexGateway/bitfinexGateway.py index 5aef41be..31c9cf52 100644 --- a/vnpy/trader/gateway/bitfinexGateway/bitfinexGateway.py +++ b/vnpy/trader/gateway/bitfinexGateway/bitfinexGateway.py @@ -350,11 +350,11 @@ class GatewayApi(BitfinexApi): # 常规行情更新 if channel == 'ticker': - tick.volume = l[-3] - tick.highPrice = l[-2] - tick.lowPrice = l[-1] - tick.lastPrice = l[-4] - tick.openPrice = tick.lastPrice - l[4] + tick.volume = float(l[-3]) + tick.highPrice = float(l[-2]) + tick.lowPrice = float(l[-1]) + tick.lastPrice = float(l[-4]) + tick.openPrice = float(tick.lastPrice - l[4]) # 深度报价更新 elif channel == 'book': bid = self.bidDict.setdefault(symbol, {}) @@ -362,12 +362,20 @@ class GatewayApi(BitfinexApi): if len(l) > 3: for price, count, amount in l: + price = float(price) + count = int(count) + amount = float(amount) + if amount > 0: bid[price] = amount else: ask[price] = -amount else: price, count, amount = l + price = float(price) + count = int(count) + amount = float(amount) + if not count: if price in bid: del bid[price]