NOTE OrderBook is setting product_id as string, which sets the inherited WebsocketClient.products as string, but WebsocketClient.products is type string array
Causes issues with OrderBook property: def product_id(self):
As it's selecting the first char of the string instead of first element in array. e.g.
The product_id='BTC-USD', returns 'B' when the getter is called.
May have some other side effects in the code, but this is first I noticed
OrderBook Excerpt
class OrderBook(WebsocketClient):
def __init__(self, product_id='BTC-USD', log_to=None):
super(OrderBook, self).__init__(products=product_id)
self._asks = SortedDict()
self._bids = SortedDict()
self._client = PublicClient()
self._sequence = -1
self._log_to = log_to
if self._log_to:
assert hasattr(self._log_to, 'write')
self._current_ticker = None
@property
def product_id(self):
''' Currently OrderBook only supports a single product even though it is stored as a list of products. '''
return self.products[0]
WebsocketClient Excerpt
def _connect(self):
if self.products is None:
self.products = ["BTC-USD"]
elif not isinstance(self.products, list):
self.products = [self.products]
NOTE OrderBook is setting product_id as string, which sets the inherited WebsocketClient.products as string, but WebsocketClient.products is type string array
Causes issues with OrderBook property: def product_id(self): As it's selecting the first char of the string instead of first element in array. e.g. The product_id='BTC-USD', returns 'B' when the getter is called.
May have some other side effects in the code, but this is first I noticed
OrderBook Excerpt
WebsocketClient Excerpt