[Mod]增加BitfinexGateway行情数据的强制数字类型转换
This commit is contained in:
parent
dfe0304f74
commit
49d22b47be
@ -350,11 +350,11 @@ class GatewayApi(BitfinexApi):
|
|||||||
|
|
||||||
# 常规行情更新
|
# 常规行情更新
|
||||||
if channel == 'ticker':
|
if channel == 'ticker':
|
||||||
tick.volume = l[-3]
|
tick.volume = float(l[-3])
|
||||||
tick.highPrice = l[-2]
|
tick.highPrice = float(l[-2])
|
||||||
tick.lowPrice = l[-1]
|
tick.lowPrice = float(l[-1])
|
||||||
tick.lastPrice = l[-4]
|
tick.lastPrice = float(l[-4])
|
||||||
tick.openPrice = tick.lastPrice - l[4]
|
tick.openPrice = float(tick.lastPrice - l[4])
|
||||||
# 深度报价更新
|
# 深度报价更新
|
||||||
elif channel == 'book':
|
elif channel == 'book':
|
||||||
bid = self.bidDict.setdefault(symbol, {})
|
bid = self.bidDict.setdefault(symbol, {})
|
||||||
@ -362,12 +362,20 @@ class GatewayApi(BitfinexApi):
|
|||||||
|
|
||||||
if len(l) > 3:
|
if len(l) > 3:
|
||||||
for price, count, amount in l:
|
for price, count, amount in l:
|
||||||
|
price = float(price)
|
||||||
|
count = int(count)
|
||||||
|
amount = float(amount)
|
||||||
|
|
||||||
if amount > 0:
|
if amount > 0:
|
||||||
bid[price] = amount
|
bid[price] = amount
|
||||||
else:
|
else:
|
||||||
ask[price] = -amount
|
ask[price] = -amount
|
||||||
else:
|
else:
|
||||||
price, count, amount = l
|
price, count, amount = l
|
||||||
|
price = float(price)
|
||||||
|
count = int(count)
|
||||||
|
amount = float(amount)
|
||||||
|
|
||||||
if not count:
|
if not count:
|
||||||
if price in bid:
|
if price in bid:
|
||||||
del bid[price]
|
del bid[price]
|
||||||
|
Loading…
Reference in New Issue
Block a user