A local Binance DepthCache Manager for Python that supports multiple depth caches in one instance in a easy, fast, flexible, robust and fully-featured way.
Part of ‘UNICORN Binance Suite’.
Create a local depth_cache for Binance with just 3 lines of code:
import unicorn_binance_local_depth_cache
ubldc = unicorn_binance_local_depth_cache.BinanceLocalDepthCacheManager(exchange="binance.com")
ubldc.create_depth_cache("LUNABTC")
Get the asks and bids depth with:
asks = ubldc.get_asks("LUNABTC")
bids = ubldc.get_bids("LUNABTC")
Catch an exception, if the depth_cache is out of sync while accessing its data:
try:
print(f"Top 10 asks: {ubldc.get_asks(market=market)[:10]}")
print(f"Top 10 bids: {ubldc.get_bids(market=market)[:10]}")
except DepthCacheOutOfSync as error_msg:
print(f"ERROR: {error_msg}")
Stop and delete a depth_cache:
ubldc.stop_depth_cache("LUNABTC")
Stop the full instance:
ubldc.stop_manager_with_all_depth_caches()
Info: https://www.lucit.tech/unicorn-binance-local-depth-cache.html
Have fun
Best regards,
Oliver