Skip to content

Commit

Permalink
Added options multiplex socket
Browse files Browse the repository at this point in the history
  • Loading branch information
Ollie-Hooper committed Apr 8, 2021
1 parent 0c19ba8 commit f1116df
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions binance/websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,29 @@ def start_multiplex_socket(self, streams, callback):
stream_path = 'streams={}'.format('/'.join(streams))
return self._start_socket(stream_path, callback, 'stream?')

def start_options_multiplex_socket(self, streams, callback):
"""Start a multiplexed socket using a list of socket names.
User stream sockets can not be included.
Symbols in socket name must be lowercase i.e bnbbtc@aggTrade, neobtc@ticker
Combined stream events are wrapped as follows: {"stream":"<streamName>","data":<rawPayload>}
https://binance-docs.github.io/apidocs/voptions/en/#account-and-trading-interface
:param streams: list of stream names in lower case
:type streams: list
:param callback: callback function to handle messages
:type callback: function
:returns: connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
"""
stream_path = 'streams={}'.format('/'.join([s.lower() for s in streams]))
return self._start_options_socket(stream_path, callback, 'stream?')

def start_user_socket(self, callback):
"""Start a websocket for user data
Expand Down

0 comments on commit f1116df

Please sign in to comment.