@@ -58,8 +58,8 @@ class SpotWSClientBase(SpotAsyncClient):
5858 """
5959
6060 LOG : logging .Logger = logging .getLogger (__name__ )
61- PROD_ENV_URL : str = "ws.kraken.com"
62- AUTH_PROD_ENV_URL : str = "ws-auth.kraken.com"
61+ WS_URL : str = "wss:// ws.kraken.com"
62+ AUTH_WS_URL : str = "wss:// ws-auth.kraken.com"
6363 # Changing this can cause errors, as this class is designed for v2.
6464 API_V : str = "/v2"
6565
@@ -70,8 +70,14 @@ def __init__( # nosec: B107
7070 callback : Callable | None = None ,
7171 * ,
7272 no_public : bool = False ,
73+ rest_url : str | None = None ,
74+ ws_url : str | None = None ,
75+ auth_ws_url : str | None = None ,
7376 ) -> None :
74- super ().__init__ (key = key , secret = secret )
77+ super ().__init__ (key = key , secret = secret , url = rest_url )
78+ self .WS_URL = ws_url or self .WS_URL
79+ self .AUTH_WS_URL = auth_ws_url or self .AUTH_WS_URL
80+
7581 self .state : WSState = WSState .INIT
7682 self ._is_auth : bool = bool (key and secret )
7783 self .__callback : Callable | None = callback
@@ -92,13 +98,13 @@ def __prepare_connect(self: SpotWSClientBase, *, no_public: bool) -> None:
9298 """Set up functions and attributes based on the API version."""
9399
94100 # pylint: disable=invalid-name
95- self .PROD_ENV_URL += self .API_V
96- self .AUTH_PROD_ENV_URL += self .API_V
101+ self .WS_URL += self .API_V
102+ self .AUTH_WS_URL += self .API_V
97103
98104 self ._pub_conn = (
99105 ConnectSpotWebsocket (
100106 client = self ,
101- endpoint = self .PROD_ENV_URL ,
107+ endpoint = self .WS_URL ,
102108 is_auth = False ,
103109 callback = self .on_message ,
104110 )
@@ -109,7 +115,7 @@ def __prepare_connect(self: SpotWSClientBase, *, no_public: bool) -> None:
109115 self ._priv_conn = (
110116 ConnectSpotWebsocket (
111117 client = self ,
112- endpoint = self .AUTH_PROD_ENV_URL ,
118+ endpoint = self .AUTH_WS_URL ,
113119 is_auth = True ,
114120 callback = self .on_message ,
115121 )
0 commit comments