Rewrite reconnection system with numerous fixes.

This commit is contained in:
Davide Casale
2023-02-15 21:48:34 +01:00
parent 99f58ddb04
commit fa9bdfc333
9 changed files with 98 additions and 60 deletions

View File

@@ -1,4 +1,4 @@
from typing import TypedDict, Union, Optional
from typing import TypedDict, Union, Literal, Optional
__all__ = [
"Subscription",
@@ -10,22 +10,22 @@ __all__ = [
"Status"
]
_Header = TypedDict("_Header", { "event": str, "channel": str, "subId": str })
_Header = TypedDict("_Header", { "event": Literal["subscribed"], "channel": str, "chanId": int })
Subscription = Union["Ticker", "Trades", "Book", "Candles", "Status"]
class Ticker(TypedDict):
chanId: int; symbol: str
subId: str; symbol: str
pair: Optional[str]
currency: Optional[str]
class Trades(TypedDict):
chanId: int; symbol: str
subId: str; symbol: str
pair: Optional[str]
currency: Optional[str]
class Book(TypedDict):
chanId: int
subId: str
symbol: str
prec: str
freq: str
@@ -33,9 +33,9 @@ class Book(TypedDict):
pair: str
class Candles(TypedDict):
chanId: int
subId: str
key: str
class Status(TypedDict):
chanId: int
subId: str
key: str