Skip to content

Commit

Permalink
Fix BinanceWebSocketClient config and typing
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Oct 23, 2023
1 parent 773b9d7 commit 6924465
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 8 additions & 1 deletion nautilus_trader/adapters/binance/websocket/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from nautilus_trader.common.logging import Logger
from nautilus_trader.common.logging import LoggerAdapter
from nautilus_trader.core.nautilus_pyo3 import WebSocketClient
from nautilus_trader.core.nautilus_pyo3 import WebSocketConfig


class BinanceWebSocketClient:
Expand Down Expand Up @@ -120,10 +121,16 @@ async def connect(self) -> None:

self._log.debug(f"Connecting to {ws_url}...")
self._is_connecting = True
self._inner = await WebSocketClient.connect(

config = WebSocketConfig(
url=ws_url,
handler=self._handler,
heartbeat=60,
headers=[],
)

self._inner = await WebSocketClient.connect(
config=config,
post_reconnection=self.reconnect,
)
self._is_connecting = False
Expand Down
4 changes: 1 addition & 3 deletions nautilus_trader/core/nautilus_pyo3.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,7 @@ class WebSocketClient:
@classmethod
def connect(
cls,
url: str,
handler: Callable[..., Any],
heartbeat: int | None = None,
config: WebSocketConfig,
post_connection: Callable[..., None] | None = None,
post_reconnection: Callable[..., None] | None = None,
post_disconnection: Callable[..., None] | None = None,
Expand Down

0 comments on commit 6924465

Please sign in to comment.