Skip to content

Commit

Permalink
c tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-zehentleitner committed May 27, 2024
1 parent 559792b commit 9737558
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

[How to upgrade to the latest version!](https://unicorn-binance-local-depth-cache.docs.lucit.tech/readme.html#installation-and-upgrade)

## 2.0.0.dev (development stage/unreleased/unstable)
### Added
- Handling all stream signals of UBWA clearly.
## 2.1.0.dev (development stage/unreleased/unstable)

## 2.1.0
### Changed
- More granular and efficient transfer of update values.
### Fixed
- Filtering and removing 0 values now works with all formats. (0.0, 0.000, 0.0000000, ...)

- Updates were erroneously applied twice in `_init_depth_cache()`.
- Handling all stream signals of UBWA clearly.

## 2.0.0
Scaling. The core functions have been rewritten in this update. Instead of one stream per depth_cache, we now use one
Expand Down
2 changes: 2 additions & 0 deletions examples/ubldc-demo/ubldc-demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
title: str = "UBLDC Demo"
threshold_volume: float = 200000.0
threshold_volume_limit_count: int = 3
update_interval = 100

logging.getLogger("unicorn_binance_local_depth_cache")
logging.basicConfig(level=logging.DEBUG,
Expand Down Expand Up @@ -65,6 +66,7 @@ async def main():


with BinanceLocalDepthCacheManager(exchange=exchange,
depth_cache_update_interval=update_interval,
websocket_ping_interval=10,
websocket_ping_timeout=15) as ubldc:
try:
Expand Down
19 changes: 14 additions & 5 deletions unicorn_binance_local_depth_cache/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ def _get_book_side(self,
market: str = None,
limit_count: int = None,
reverse: bool = False,
side: str = "",
side: str = None,
threshold_volume: float = None) -> list:
"""
Get the current list of bids with price and quantity.
Expand All @@ -815,6 +815,8 @@ def _get_book_side(self,
:type threshold_volume: float or None (0 is nothing, None is everything)
:return: list
"""
if side is None:
raise ValueError("Side must be specified.")
if market is None:
raise DepthCacheNotFound(market=market)
market = market.lower()
Expand All @@ -829,10 +831,17 @@ def _get_book_side(self,
except KeyError:
raise DepthCacheNotFound(market=market)
with self.threading_lock_bid[market]:
return self._sort_depth_cache(items=self.depth_caches[market][side],
limit_count=limit_count,
reverse=reverse,
threshold_volume=threshold_volume)
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)

@staticmethod
def get_latest_release_info() -> Optional[dict]:
Expand Down
21 changes: 21 additions & 0 deletions unicorn_binance_local_depth_cache/manager_cy.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ¯\_(ツ)_/¯
#
# File: unicorn_binance_local_depth_cache/manager_cy.pyx
#
# Part of ‘UNICORN Binance Local Depth Cache’
# Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html
# Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache
# Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech
# PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache
# LUCIT Online Shop: https://shop.lucit.services/software
#
# License: LSOSL - LUCIT Synergetic Open Source License
# https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE
#
# Author: LUCIT Systems and Development
#
# Copyright (c) 2022-2024, LUCIT Systems and Development - https://www.lucit.tech
# All rights reserved.

0 comments on commit 9737558

Please sign in to comment.