MCPcopy Create free account
hub / github.com/sammchardy/python-binance / main

Function main

examples/depth_cache_threaded_example.py:16–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14
15
16def main():
17 dcm = ThreadedDepthCacheManager()
18 dcm.start()
19
20 def handle_depth_cache(depth_cache):
21 if isinstance(depth_cache, dict) and depth_cache.get("e") == "error":
22 logger.error(f"Received depth cache error in callback: {depth_cache}")
23 type = depth_cache.get("type")
24 if type == "BinanceWebsocketClosed":
25 # Automatically attempts to reconnect
26 return
27 logger.error(f"Error received - Closing depth cache: {depth_cache}")
28 dcm.stop()
29 return
30
31 logger.info(f"symbol {depth_cache.symbol}") # type: ignore[union-attr]
32 logger.info(depth_cache.get_bids()[:5]) # type: ignore[union-attr]
33
34 dcm.start_depth_cache(handle_depth_cache, symbol="BNBBTC")
35 dcm.join()
36
37
38if __name__ == "__main__":

Callers 1

Calls 2

start_depth_cacheMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…