Bitcoin Forum
May 08, 2024, 02:28:58 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Python API "UNICORN Binance WebSocket API"  (Read 167 times)
alice_bob (OP)
Sr. Member
****
Offline Offline

Activity: 318
Merit: 250



View Profile WWW
June 04, 2019, 01:42:03 PM
Last edit: January 27, 2022, 01:23:57 PM by alice_bob
 #1

Hello!

I would like to introduce a python API to manage websockets to binance!

Project: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api

Code:
import unicorn_binance_websocket_api

ubwa = unicorn_binance_websocket_api.BinanceWebSocketApiManager(exchange="binance.com")
ubwa.create_stream(['trade', 'kline_1m'], ['btcusdt', 'bnbbtc', 'ethbtc'])

while True:
    oldest_data_from_stream_buffer = ubwa.pop_stream_data_from_stream_buffer()
    if oldest_data_from_stream_buffer:
        print(oldest_data_from_stream_buffer)

# What are the benefits of the UNICORN Binance WebSocket API?

  • Fully managed websockets and 100% auto-reconnect! Also handles maintenance windows!
  •     Streams are processing asynchronous/concurrent (Python asyncio) and each stream is started in a separate thread, so 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 subscribe/unsubscribe on all exchanges! (Take a look to the max supported subscriptions per stream in the endpoint configuration overview!)
  •     UNICORN Binance WebSocket API respects Binance's API guidelines and protects you from avoidable reconnects and bans.
  •     Support for multiple private !userData streams with different api_key and api_secret. (example_multiple_userdata_streams.py)
  •     Pick up the received data from the stream_buffer - 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!
  •     Use separate stream_buffers for specific streams or users!
  •     Watch the stream_signal_buffer to receive CONNECT, DISCONNECT and FIRST_RECEIVED_DATA signals about the streams! Learn more!
  •     Get the received data unchanged as received, as Python dictionary or converted with UnicornFy into well-formed Python dictionaries. Use the output parameter of create_stream() to control the output format.
  •     Helpful management features like get_binance_api_status(), get_current_receiving_speed(), get_errors_from_endpoints(), get_limit_of_subscriptions_per_stream(), get_request_id(), get_result_by_request_id(), get_results_from_endpoints(), get_stream_buffer_length(), get_stream_info(), get_stream_list(), get_stream_id_by_label(), get_stream_statistic(), get_stream_subscriptions(), get_version(), is_update_availabe(), pop_stream_data_from_stream_buffer(), print_summary(), replace_stream(), set_stream_label(), set_ringbuffer_error_max_size(), subscribe_to_stream(), stop_stream(), stop_manager_with_all_streams(), unsubscribe_from_stream(), wait_till_stream_has_started() and many more! Explore them here.
  •     Monitor the status of the created BinanceWebSocketApiManager() instance within your code with get_monitoring_status_plain() and specific streams with get_stream_info().
  •     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
  •     Also nice to use with the Jupyter Notebook Smiley
  •     Monitoring API service and a check_command for ICINGA/Nagios icinga2-demo
  •     Excessively tested on Linux, Mac and Windows

Best regards,
Oliver

1715178538
Hero Member
*
Offline Offline

Posts: 1715178538

View Profile Personal Message (Offline)

Ignore
1715178538
Reply with quote  #2

1715178538
Report to moderator
1715178538
Hero Member
*
Offline Offline

Posts: 1715178538

View Profile Personal Message (Offline)

Ignore
1715178538
Reply with quote  #2

1715178538
Report to moderator
1715178538
Hero Member
*
Offline Offline

Posts: 1715178538

View Profile Personal Message (Offline)

Ignore
1715178538
Reply with quote  #2

1715178538
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715178538
Hero Member
*
Offline Offline

Posts: 1715178538

View Profile Personal Message (Offline)

Ignore
1715178538
Reply with quote  #2

1715178538
Report to moderator
1715178538
Hero Member
*
Offline Offline

Posts: 1715178538

View Profile Personal Message (Offline)

Ignore
1715178538
Reply with quote  #2

1715178538
Report to moderator
1715178538
Hero Member
*
Offline Offline

Posts: 1715178538

View Profile Personal Message (Offline)

Ignore
1715178538
Reply with quote  #2

1715178538
Report to moderator
alice_bob (OP)
Sr. Member
****
Offline Offline

Activity: 318
Merit: 250



View Profile WWW
June 19, 2019, 11:53:35 AM
Last edit: January 27, 2022, 01:24:28 PM by alice_bob
 #2

We added support for Binance Jersey!

Code:
ubwa = unicorn_binance_websocket_api.BinanceWebSocketApiManager(exchange="binance.je")

alice_bob (OP)
Sr. Member
****
Offline Offline

Activity: 318
Merit: 250



View Profile WWW
June 27, 2019, 08:53:18 PM
Last edit: January 27, 2022, 01:25:37 PM by alice_bob
 #3

Added support for Binance DEX and Binance DEX testnet:
https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/blob/master/example_binance_dex.py

alice_bob (OP)
Sr. Member
****
Offline Offline

Activity: 318
Merit: 250



View Profile WWW
October 07, 2019, 08:55:23 PM
Last edit: January 27, 2022, 01:24:55 PM by alice_bob
 #4

Added support for binance.us Websockets:
https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/blob/master/example_binance_us.py

alice_bob (OP)
Sr. Member
****
Offline Offline

Activity: 318
Merit: 250



View Profile WWW
November 05, 2019, 09:12:27 AM
Last edit: January 27, 2022, 01:25:14 PM by alice_bob
 #5

Endpoints for binance.com futures are now implemented:
https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/blob/master/example_binance_futures.py

alice_bob (OP)
Sr. Member
****
Offline Offline

Activity: 318
Merit: 250



View Profile WWW
September 21, 2021, 12:57:54 PM
Last edit: May 12, 2022, 11:30:32 AM by alice_bob
 #6

UNICORN Binance Suite:
- unicorn-fy
- unicorn-binance-local-depth-cache
- unicorn-binance-rest-api
- unicorn-binance-trailing-stop-loss
- unicorn-binance-websocket-api

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!