From be9a69a1931d60e11bcc96f727497abf3930a1a7 Mon Sep 17 00:00:00 2001 From: m5l14i11 Date: Tue, 10 Sep 2024 21:46:46 +0300 Subject: [PATCH] upd --- exchange/_bybit_ws.py | 4 ++-- risk/_actor.py | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/exchange/_bybit_ws.py b/exchange/_bybit_ws.py index 8af74bff..2e9275a4 100644 --- a/exchange/_bybit_ws.py +++ b/exchange/_bybit_ws.py @@ -52,8 +52,8 @@ async def _connect_to_websocket(self): self.ws = await websockets.connect( self.wss, open_timeout=None, - ping_interval=30, - ping_timeout=15, + ping_interval=18, + ping_timeout=10, close_timeout=None, ) diff --git a/risk/_actor.py b/risk/_actor.py index 6d66e7fb..dce7f04b 100644 --- a/risk/_actor.py +++ b/risk/_actor.py @@ -112,16 +112,11 @@ async def _handle_position_risk(self, event: NewMarketDataReceived): indexes = list(range(num_positions)) random.shuffle(indexes) - current_index = 0 - - for _ in range(num_positions): - shuffled_index = indexes[current_index] + for shuffled_index in indexes: processed_positions[shuffled_index] = await self._process_market( event, self._position[shuffled_index] ) - current_index = (current_index + 1) % num_positions - self._position = tuple(processed_positions) async def _trail_position(self, event: TrailEvent):