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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 157769c85cd240577a8bd9e6733cc2f6691ade7885c71cf837350a49a76d800e |
|
MD5 | ea4edf34e80581ee500c5dc0d87f6e1e |
|
BLAKE2b-256 | a95fce9f1cbc1ad6cf92f101327c79188c21454bcff737be9598d95873209976 |
Close
Hashes for three_commas_websocket_assist-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66fda4752e9c7ec30b2f0da7adbb8503c181a3b2846c19fdf2ba3bc126f4318a |
|
MD5 | ccb582ea63b735b0df25494f11645247 |
|
BLAKE2b-256 | ea7f4f9eb4ea051b465f978e180e5f014c7af664c69069240e50698ed19beae6 |