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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef74fb56cf3a2ed208f90ad55ae559589185d9fd73dc5d27999b6b093aab1169 |
|
MD5 | 4b1c606d088bed83b153e3c35429e5e1 |
|
BLAKE2b-256 | 32a83df4a6e0b52c81d9282950124672e8fbb3d5456ec288f11f8e1df0f5b94b |
Close
Hashes for three_commas_websocket_assist-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0457d5db52c7a9ba207522aed910348efe4f7f2830c7a5f6a4be165dfa2d6ca0 |
|
MD5 | e28b566521f751aa747a5d73a5c77dd6 |
|
BLAKE2b-256 | 17420d509393b86aedfe57969269ff1bdbcc7166ccd9906ff069fe8663eb4f7f |