Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 1bfa9dc

Browse files
author
Michael Stolovitzsky
committed
infinite loop in set_book_depth()
1 parent b5a1c18 commit 1bfa9dc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bittrex_websocket/_auxiliary.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def find_ticker_type(tickers):
2727

2828

2929
class Ticker(object):
30+
ORDERBOOK_DEPTH_TIMEOUT = 40
31+
3032
def __init__(self):
3133
self.list = {}
3234
self.sub_types = [SUB_TYPE_ORDERBOOK,
@@ -143,10 +145,12 @@ def set_book_depth(self, tickers, book_depth):
143145
tickers_list = find_ticker_type(tickers)
144146
for ticker in tickers_list:
145147
timeout = 0
146-
while timeout < 40:
148+
while timeout < self.ORDERBOOK_DEPTH_TIMEOUT:
147149
while ticker not in self.list:
148150
sleep(0.5)
149151
timeout += 0.5
152+
if timeout > self.ORDERBOOK_DEPTH_TIMEOUT:
153+
raise RuntimeError("Unable to set order book depth, timeout")
150154
else:
151155
self.list[ticker][SUB_TYPE_ORDERBOOK]['OrderBookDepth'] = book_depth
152156
logger.info(

0 commit comments

Comments
 (0)