@@ -231,7 +231,7 @@ def __init__(
231231 self ._data_stream = _data_stream
232232 self ._debug = debug
233233 self ._raw_data = raw_data
234- self .stop_stream_queue = queue .Queue ()
234+ self ._stop_stream_queue = queue .Queue ()
235235
236236 self .trading_ws = _StreamConn (self ._key_id ,
237237 self ._secret_key ,
@@ -342,8 +342,8 @@ def run(self, initial_channels: List[str] = []):
342342 logging .error (f"error while consuming ws messages: { m } " )
343343 if self ._debug :
344344 traceback .print_exc ()
345- if not self .stop_stream_queue .empty ():
346- self .stop_stream_queue .get ()
345+ if not self ._stop_stream_queue .empty ():
346+ self ._stop_stream_queue .get ()
347347 should_renew = False
348348 loop .run_until_complete (self .close (should_renew ))
349349 if loop .is_running ():
@@ -378,12 +378,11 @@ async def close(self, renew):
378378 self ._oauth ,
379379 raw_data = self ._raw_data )
380380
381- async def signal_stop_ws (self ):
381+ async def stop_ws (self ):
382382 """
383- Signal the ws connections to stop.
384- We set a signal in a Queue and then call cancel_task
383+ Signal the ws connections to stop listenning to api stream.
385384 """
386- self .stop_stream_queue .put_nowait ({"should_stop" : True })
385+ self ._stop_stream_queue .put_nowait ({"should_stop" : True })
387386 if self .trading_ws is not None :
388387 logging .info ("Stopping the trading websocket connection" )
389388 await self .trading_ws .cancel_task ()
0 commit comments