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.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bea2b71de44971f37ef262f053cd5e24571363e50513d3795ee51805972c15ad |
|
MD5 | ebf4fe3195113426e6e427302711e5a3 |
|
BLAKE2b-256 | 33f10f410f9791d15c622fbac4a9e8af8277d5010a9b9dffd7df1560d904c970 |
Close
Hashes for three_commas_websocket_assist-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31616b1ee7a4972f200049bf5b1b88a55c5e8b876ef24940b4ce8f0b635a3e47 |
|
MD5 | 17e926e7a06784345342bce8a976bf1e |
|
BLAKE2b-256 | 8dac97f851d78253a0f429d145cd2b0f44378da066e6f51f865fef6ec643d90e |