A python API to use the Binance Websocket API's (com, com-margin, com-futures, jersey, us, jex, dex/chain+testnet) in a easy, fast, flexible, robust and fully-featured way.

The python module UNICORN Binance WebSocket API provides an API to the Binance Websocket API`s of Binance, Binance Margin, Binance Futures, Binance Jersey, Binance US, Binance JEX, Binance DEX and Binance DEX Testnet and supports the streaming of all public streams like trade, kline, ticker, depth, bookTicker, forceOrder and blockheight and also all private userData streams which needs to be used with a valid api_key and api_secret from the Binance Exchange www.binance.com,

What are the benefits of the UNICORN Binance WebSocket API?

  • Fully managed websockets and 100% auto-reconnect!
  • Supported exchanges:
    • Binance BinanceWebSocketApiManager(exchange="binance.com")
    • Binance Margin BinanceWebSocketApiManager(exchange="binance.com-margin")
    • Binance Futures BinanceWebSocketApiManager(exchange="binance.com-futures")
    • Binance Jersey BinanceWebSocketApiManager(exchange="binance.je")
    • Binance US BinanceWebSocketApiManager(exchange="binance.us")
    • Binance JEX BinanceWebSocketApiManager(exchange="jex.com")
    • Binance DEX BinanceWebSocketApiManager(exchange="binance.org")
    • Binance DEX testnet BinanceWebSocketApiManager(exchange="binance.org-testnet")
  • Streams are processing asynchronous/concurrent (python asyncio) and each stream is started in a separate thread, but you dont need to deal with asyncio in your code!
  • No use of the twisted module, so you can use this lib in a daemonized application (compatible with python-daemon).
  • Supports subscriptions/unsubscribe on all exchanges! (Maximum 1024 subscriptions per stream!)
  • Support for multiple private !userData streams with different api_key and api_secret .
  • If you can not store your data in cause of a temporary technical issue, you can kick back the data to the stream_buffer which stores the receives in the RAM till you are able to process the data in the normal way again. Learn more!
  • Compatible with UnicornFy to convert received raw data from crypto API endpoints into well-formed python dictionaries.
  • Helpful management features like get_binance_api_status() , get_stream_info() , get_stream_list() , get_stream_statistic() , get_stream_subscriptions() , replace_stream() , wait_till_stream_has_started() , get_current_receiving_speed() , subscribe_to_stream() , unsubscribe_from_stream() and many more, explore them here.
  • Nice to use with iPython: “IPython (Interactive Python) is a command shell for interactive computing that offers introspection, rich media, shell syntax, tab completion, and history.” (example_interactive_mode.py) iPython
  • Monitoring API service and a check_command for ICINGA/Nagios icinga2-demo
  • Excessively tested on Linux, Mac and Windows

Best regards,
Oliver

The lib is stable now:

https://ubwa-demo.lucit.co/print_summary.php