Skip to content

Commit

Permalink
2.1.0 RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-zehentleitner committed May 27, 2024
1 parent 9737558 commit bc1c333
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 35 deletions.
22 changes: 8 additions & 14 deletions unicorn_binance_local_depth_cache/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self, exchange: str = "binance.com",
super().__init__()
self.name = __app_name__
self.version = __version__
logger.info(f"New instance of {self.get_user_agent()}-{'compiled-nogil' if cython.compiled else 'source'} on "
logger.info(f"New instance of {self.get_user_agent()}-{'compiled' if cython.compiled else 'source'} on "
f"{str(platform.system())} {str(platform.release())} for exchange {exchange} started ...")
self.exchange = exchange
self.depth_caches: dict = {}
Expand Down Expand Up @@ -686,8 +686,7 @@ def _sort_depth_cache(items: dict,
:type threshold_volume: float
:return: list
"""
logger.debug(f"BinanceLocalDepthCacheManager._sort_depth_cache() - Start sorting "
f"{'with nogil ...' if cython.compiled else '...'}")
logger.debug(f"BinanceLocalDepthCacheManager._sort_depth_cache() - Start sorting ...")
sorted_items = [[float(price), float(quantity)] for price, quantity in items.items()]
sorted_items = sorted(sorted_items, key=itemgetter(0), reverse=reverse)
if threshold_volume is None:
Expand Down Expand Up @@ -811,6 +810,8 @@ def _get_book_side(self,
:type limit_count: int or None (0 is nothing, None is everything)
:param reverse: False is regular, True is reversed
:type reverse: bool
:param side: asks or bids
:type side: str
:param threshold_volume: Volume threshold to trim the result.
:type threshold_volume: float or None (0 is nothing, None is everything)
:return: list
Expand All @@ -831,17 +832,10 @@ def _get_book_side(self,
except KeyError:
raise DepthCacheNotFound(market=market)
with self.threading_lock_bid[market]:
if cython.compiled is True:
with cython.nogil:
return self._sort_depth_cache(items=self.depth_caches[market][side],
limit_count=limit_count,
reverse=reverse,
threshold_volume=threshold_volume)
else:
return self._sort_depth_cache(items=self.depth_caches[market][side],
limit_count=limit_count,
reverse=reverse,
threshold_volume=threshold_volume)
return self._sort_depth_cache(items=self.depth_caches[market][side],
limit_count=limit_count,
reverse=reverse,
threshold_volume=threshold_volume)

@staticmethod
def get_latest_release_info() -> Optional[dict]:
Expand Down
21 changes: 0 additions & 21 deletions unicorn_binance_local_depth_cache/manager_cy.pyx

This file was deleted.

0 comments on commit bc1c333

Please sign in to comment.