From d0087708d122f3acb6c70251f51a53f65c024866 Mon Sep 17 00:00:00 2001 From: TheHolyRoger Date: Wed, 24 Mar 2021 17:16:20 +0000 Subject: [PATCH] CoinZoom: Remove unused code in order book --- .../coinzoom/coinzoom_active_order_tracker.pxd | 3 ++- .../coinzoom/coinzoom_active_order_tracker.pyx | 16 ++++++++-------- .../coinzoom/coinzoom_order_book_message.py | 5 +++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pxd b/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pxd index 752d47418a..881d7862df 100644 --- a/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pxd +++ b/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pxd @@ -9,4 +9,5 @@ cdef class CoinzoomActiveOrderTracker: cdef tuple c_convert_diff_message_to_np_arrays(self, object message) cdef tuple c_convert_snapshot_message_to_np_arrays(self, object message) - cdef np.ndarray[np.float64_t, ndim=1] c_convert_trade_message_to_np_array(self, object message) + # This method doesn't seem to be used anywhere at all + # cdef np.ndarray[np.float64_t, ndim=1] c_convert_trade_message_to_np_array(self, object message) diff --git a/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pyx b/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pyx index 001f1d4c1c..a7e4fcb815 100644 --- a/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pyx +++ b/hummingbot/connector/exchange/coinzoom/coinzoom_active_order_tracker.pyx @@ -135,14 +135,14 @@ cdef class CoinzoomActiveOrderTracker: return bids, asks - # Is this method actually used? - cdef np.ndarray[np.float64_t, ndim=1] c_convert_trade_message_to_np_array(self, object message): - cdef: - double trade_type_value = 1.0 if message.content[4] == "BUY" else 2.0 - list content = message.content - - return np.array([message.timestamp, trade_type_value, float(content[1]), float(content[2])], - dtype="float64") + # This method doesn't seem to be used anywhere at all + # cdef np.ndarray[np.float64_t, ndim=1] c_convert_trade_message_to_np_array(self, object message): + # cdef: + # double trade_type_value = 1.0 if message.content[4] == "BUY" else 2.0 + # list content = message.content + + # return np.array([message.timestamp, trade_type_value, float(content[1]), float(content[2])], + # dtype="float64") def convert_diff_message_to_order_book_row(self, message): np_bids, np_asks = self.c_convert_diff_message_to_np_arrays(message) diff --git a/hummingbot/connector/exchange/coinzoom/coinzoom_order_book_message.py b/hummingbot/connector/exchange/coinzoom/coinzoom_order_book_message.py index 4f91267868..d6bc00541d 100644 --- a/hummingbot/connector/exchange/coinzoom/coinzoom_order_book_message.py +++ b/hummingbot/connector/exchange/coinzoom/coinzoom_order_book_message.py @@ -47,6 +47,11 @@ def trade_id(self) -> int: def trading_pair(self) -> str: return self.content["trading_pair"] + # The `asks` and `bids` properties are only used in the methods below. + # They are all replaced or unused in this connector: + # OrderBook.restore_from_snapshot_and_diffs + # OrderBookTracker._track_single_book + # MockAPIOrderBookDataSource.get_tracking_pairs @property def asks(self): raise NotImplementedError(Constants.EXCHANGE_NAME + " order book uses active_order_tracker.")