mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 06:44:22 +01:00
Apply pylint's linting rules to examples/websocket/public/*.py.
This commit is contained in:
@@ -10,21 +10,21 @@ from bfxapi.websocket import subscriptions
|
||||
from bfxapi.websocket.enums import Channel, Error
|
||||
from bfxapi.websocket.types import TradingPairRawBook
|
||||
|
||||
class RawOrderBook(object):
|
||||
class RawOrderBook:
|
||||
def __init__(self, symbols: List[str]):
|
||||
self.__raw_order_book = {
|
||||
symbol: {
|
||||
symbol: {
|
||||
"bids": OrderedDict(), "asks": OrderedDict()
|
||||
} for symbol in symbols
|
||||
}
|
||||
|
||||
|
||||
def update(self, symbol: str, data: TradingPairRawBook) -> None:
|
||||
order_id, price, amount = data.order_id, data.price, data.amount
|
||||
|
||||
kind = (amount > 0) and "bids" or "asks"
|
||||
kind = "bids" if amount > 0 else "asks"
|
||||
|
||||
if price > 0:
|
||||
self.__raw_order_book[symbol][kind][order_id] = {
|
||||
self.__raw_order_book[symbol][kind][order_id] = {
|
||||
"order_id": order_id,
|
||||
"price": price,
|
||||
"amount": amount
|
||||
@@ -62,4 +62,4 @@ def on_t_raw_book_snapshot(subscription: subscriptions.Book, snapshot: List[Trad
|
||||
def on_t_raw_book_update(subscription: subscriptions.Book, data: TradingPairRawBook):
|
||||
raw_order_book.update(subscription["symbol"], data)
|
||||
|
||||
bfx.wss.run()
|
||||
bfx.wss.run()
|
||||
|
||||
Reference in New Issue
Block a user