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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa12de67dced59a754c432fbdc8b072849fe1f95dd2241f9d6039c5276c70e2 |
|
MD5 | 204e61232c0906301c94fd0682a14785 |
|
BLAKE2b-256 | c87627cd15a8e6bf326ce706cd9d8c8aa93e9616973374dd016c3794323856a8 |
Close
Hashes for three_commas_websocket_assist-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 982e0de9fd9b64fc1949fdf80125c11a7bc4d455338952e76fb4341a09e4a873 |
|
MD5 | 4f23a659ca3e091f453643e830201ce2 |
|
BLAKE2b-256 | b79ddea93bcd566d7cc0358afed3ab7bbcd9203fc32b4fadad41fc8ef99da5a6 |