Skip to content

Commit

Permalink
ENH: limit option is now influencing when using Huobipro and Bittrex
Browse files Browse the repository at this point in the history
  • Loading branch information
EmbarAlmog committed Aug 29, 2018
1 parent b0e103b commit 441caa6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions catalyst/exchange/ccxt/ccxt_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,11 @@ def get_orderbook(self, asset, order_type='all', limit=None):
order_types = ['bids', 'asks'] if order_type == 'all' else [order_type]
result = dict(last_traded=from_ms_timestamp(order_book['timestamp']))
for index, order_type in enumerate(order_types):
if limit is not None and index > limit - 1:
break

result[order_type] = []

if limit is not None and len(order_book[order_type]) > limit:
order_book[order_type] = order_book[order_type][:limit]

for entry in order_book[order_type]:
result[order_type].append(dict(
rate=float(entry[0]),
Expand Down

0 comments on commit 441caa6

Please sign in to comment.