Skip to content

Commit

Permalink
CoinZoom: Remove unused code in order book
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHolyRoger committed Mar 29, 2021
1 parent 1945d37 commit d008770
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit d008770

Please sign in to comment.