Python - aggregate function issues
See original GitHub issue- Bitfinex v2 API returns book items in [price, volume, timestamp] format, while aggregate function expects [price, volume] format.
order_book = ccxt.bitfinex2().fetch_l2_order_book('BTC/USD')
Traceback (most recent call last): … order_book = ccxt.bitfinex2().fetch_l2_order_book(‘BTC/USD’) File “D:\Python\Python36-32\lib\site-packages\ccxt\exchange.py”, line 787, in fetch_l2_order_book ‘bids’: self.sort_by(self.aggregate(orderbook[‘bids’]), 0, True), File “D:\Python\Python36-32\lib\site-packages\ccxt\exchange.py”, line 511, in aggregate for [price, volume] in bidasks: ValueError: too many values to unpack (expected 2)
- ordered.iteritems() should be changed to ordered.items(), as iteritems() has been removed in Python 3.
order_book = ccxt.cex().fetch_l2_order_book('BTC/USD')
Traceback (most recent call last): … order_book = ccxt.cex().fetch_l2_order_book(‘BTC/USD’) File “D:\Python\Python36-32\lib\site-packages\ccxt\exchange.py”, line 787, in fetch_l2_order_book ‘bids’: self.sort_by(self.aggregate(orderbook[‘bids’]), 0, True), File “D:\Python\Python36-32\lib\site-packages\ccxt\exchange.py”, line 514, in aggregate for price, volume in ordered.iteritems(): AttributeError: ‘collections.OrderedDict’ object has no attribute ‘iteritems’
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
fetch_order_book() doesn’t work anymore with Bitfinex v2 on ccxt v.1.9.107+. It works fine on v.1.9.106. I have not much time to investigate right now, but you get the timestamp in place of the price, for example.
@Nitrooo that is not critical in our case, because:
list(...items())
becomes critical