From f480e2371711cf7434e558b183cfd944b11ec818 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Sat, 9 May 2026 14:56:20 +0900 Subject: [PATCH] bot.py order.py --- bot.py | 2 +- order.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 58218c0..1bd0165 100644 --- a/bot.py +++ b/bot.py @@ -116,7 +116,7 @@ def on_trade(message: dict, orderman: OrderManager, state: StateManager): # ~~~~~============== PROVIDED CODE ==============~~~~~ # You probably don't need to edit anything below this line, but feel free to -# ask if you have any questions about what it is doing or how it works. If you +# ask if you have any questi채푸ons about what it is doing or how it works. If you # do need to change anything below this line, please feel free to diff --git a/order.py b/order.py index 202ba5b..6a21914 100644 --- a/order.py +++ b/order.py @@ -82,7 +82,7 @@ class OrderManager: size=size, ) - def convert(self, symbol: str, size: int): + def buy_convert(self, symbol: str, size: int): if symbol == "VALE": self.future_positions["VALE"] -= size self.future_positions["VALBZ"] += size @@ -95,6 +95,19 @@ class OrderManager: size=size, ) + def sell_convert(self, symbol: str, size: int): + if symbol == "VALBZ": + self.future_positions["VALBZ"] -= size + self.future_positions["VALE"] += size + self.positions["VALBZ"] -= size + self.positions["VALE"] += size + return self.exchange.send_convert_message( + order_id=self._next_order(), + symbol=symbol, + dir="SELL", + size=size, + ) + def buy(self, symbol: str, price: int, size: int): return self._attempt_send( "add",