Move subscriptions type hinting from bfxapi/websocket/types.py to bfxapi/websocket/subscriptions.py.

This commit is contained in:
Davide Casale
2023-01-19 18:00:51 +01:00
parent c471a3b52b
commit 5fe4d83902
7 changed files with 54 additions and 69 deletions

View File

@@ -1,13 +1,15 @@
# python -c "from examples.websocket.ticker import *"
from bfxapi import Client, Constants
from bfxapi.websocket import subscriptions
from bfxapi.websocket.enums import Channels
from bfxapi.websocket.types import Subscriptions, TradingPairTicker
from bfxapi.websocket.types import TradingPairTicker
bfx = Client(WSS_HOST=Constants.PUB_WSS_HOST)
@bfx.wss.on("t_ticker_update")
def on_t_ticker_update(subscription: Subscriptions.TradingPairTicker, data: TradingPairTicker):
def on_t_ticker_update(subscription: subscriptions.Ticker, data: TradingPairTicker):
print(f"Subscription with channel ID: {subscription['chanId']}")
print(f"Data: {data}")