3commas websocket stream assist
Project description
three-commas-websocket-assist
GNU General Public License v3.0
pip install three-commas-websocket-assist
Import
from three-commas-websocket-assist import ThreeCommasWebsocketHandler
1. Setting up the listener
Pass 3commas api key/secret and the channel you desire to ThreeCommasWebsocketHandler
:
st = ThreeCommasWebsocketHandler(
api_key=API_KEY,
api_secret=API_SECRET,
channel="DealsChannel",
)
ThreeCommasWebsocketHandler
automatically generates the stream identifier and uses that for the stream
2. Handle event
Pass a custom event handler to the ThreeCommasWebsocketHandler
to handle any event based on your deal channel:
Event handler is Callable[[Dict], None]
st = ThreeCommasWebsocketHandler(
api_key=API_KEY,
api_secret=API_SECRET,
channel="DealsChannel",
external_event_handler=sample_event_handler
)
Sample event handler:
def sample_event_handler(data:Dict) -> None:
"""
Sample Event Handler for websocket
"""
_LOGGER.debug("Bot_id: %s", data['bot_id'])
# Do something with the data here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for three-commas-websocket-assist-0.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07cadf972143f86bc0113cb1c9ae44d785527f7dbd982e0c992a1bc9e1ba0937 |
|
MD5 | ae6889ad79af204382d67172d5428446 |
|
BLAKE2b-256 | fde65be5a508aa5a795b8b7062d523e8b38059487daf6e4ed33ef52edb90fd98 |
Close
Hashes for three_commas_websocket_assist-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2a9f02c1ae771121bd4b22abfc4e3e15b70b8a6492d11b8a1cb4846f0ebbdda |
|
MD5 | e8d263305e3bfb9c68f2bdb01c7b165b |
|
BLAKE2b-256 | 180f0231bcbe0d818eb8536e4b3bc7147306f943a52daa9c3dc7fe7bffbf249a |