symbols = ['BTCUSDT', 'ETHUSDT'] twm = ThreadedWebsocketManager() twm.start() twm.start_multiplex_socket(callback=lambda msg: print('Spot:', msg), streams=[f'{s.lower()}@bookTicker' for s in symbols]) twm.start_futures_multiplex_socket(callback=lambda msg: print('Futures:', msg), streams=[f'{s.lower()}@bookTicker' for s in symbols])
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter