mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 06:44:22 +01:00
Move subscriptions type hinting from bfxapi/websocket/types.py to bfxapi/websocket/subscriptions.py.
This commit is contained in:
@@ -6,8 +6,9 @@ from typing import List
|
||||
|
||||
from bfxapi import Client, Constants
|
||||
|
||||
from bfxapi.websocket import subscriptions
|
||||
from bfxapi.websocket.enums import Channels, Error
|
||||
from bfxapi.websocket.types import Subscriptions, TradingPairBook
|
||||
from bfxapi.websocket.types import TradingPairBook
|
||||
|
||||
class OrderBook(object):
|
||||
def __init__(self, symbols: List[str]):
|
||||
@@ -53,12 +54,12 @@ def on_subscribed(subscription):
|
||||
print(f"Subscription successful for pair <{subscription['pair']}>")
|
||||
|
||||
@bfx.wss.on("t_book_snapshot")
|
||||
def on_t_book_snapshot(subscription: Subscriptions.Book, snapshot: List[TradingPairBook]):
|
||||
def on_t_book_snapshot(subscription: subscriptions.Book, snapshot: List[TradingPairBook]):
|
||||
for data in snapshot:
|
||||
order_book.update(subscription["symbol"], data)
|
||||
|
||||
@bfx.wss.on("t_book_update")
|
||||
def on_t_book_update(subscription: Subscriptions.Book, data: TradingPairBook):
|
||||
def on_t_book_update(subscription: subscriptions.Book, data: TradingPairBook):
|
||||
order_book.update(subscription["symbol"], data)
|
||||
|
||||
bfx.wss.run()
|
||||
Reference in New Issue
Block a user