From 1b2657cf41c3fc769b303bad0522c9984a98c509 Mon Sep 17 00:00:00 2001 From: m5l14i11 Date: Tue, 30 Apr 2024 16:47:29 +0300 Subject: [PATCH] upd --- sor/_router.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sor/_router.py b/sor/_router.py index 80f3eb12..45c8e8a3 100644 --- a/sor/_router.py +++ b/sor/_router.py @@ -307,6 +307,10 @@ async def close_position(self, command: ClosePosition): f"Trying to reduce order -> algo price: {price}, theo price: {exit_price}, spread: {spread}, max spread: {max_spread}" ) + if max_spread < 0: + self.exchange.close_full_position(symbol, position_side) + break + curr_time = time.time() expired_orders = [ order_id