Open 1163849662 opened 1 year ago
My code doesn't have any output, can you give a correct example thanks
from binance import ThreadedWebsocketManager
def main(): dcm = ThreadedWebsocketManager()
dcm.start() def handle_depth_cache(depth_cache): print(f"symbol {depth_cache.symbol}") print("top 5 bids") print(depth_cache.get_bids()[:5]) print("top 5 asks") print(depth_cache.get_asks()[:5]) print("last update time {}".format(depth_cache.update_time)) dcm_name = dcm.start_futures_depth_socket(handle_depth_cache, symbol='BNBBTC') dcm.join()
if name == "main": main()
what is depth cache, could u explain what it aimed for?
from binance import ThreadedWebsocketManager
def main(): dcm = ThreadedWebsocketManager()
start is required to initialise its internal loop
if name == "main": main()