From 46255a8c055e9c6490bbdcf172a3e710a9f6faa6 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Sat, 9 May 2026 15:47:04 +0900 Subject: [PATCH] fix convert --- order.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/order.py b/order.py index 2f35660..e1a40f7 100644 --- a/order.py +++ b/order.py @@ -75,6 +75,7 @@ class OrderManager: elif action_type == "cancel": self.exchange.send_cancel_message(**kwargs) elif action_type == "convert": + self.exchange.send_convert_message(**kwargs) # 전송한 시간 기록 @@ -128,13 +129,25 @@ class OrderManager: ) def convert(self, symbol: str, dir: str, size: int): - return self._attempt_send( + result = self._attempt_send( "convert", order_id=self.next_order(), symbol=symbol, dir=dir, size=size, ) + if result and symbol == "VALE": + if dir == Dir.BUY: + self.positions["VALE"] -= size + self.positions["VALBZ"] += size + self.future_positions["VALE"] -= size + self.future_positions["VALBZ"] += size + else: + self.positions["VALE"] += size + self.positions["VALBZ"] -= size + self.future_positions["VALE"] += size + self.future_positions["VALBZ"] -= size + return result def cancel(self, order_id: int): return self._attempt_send("cancel", order_id=order_id)