bot.py order.py

This commit is contained in:
2026-05-09 14:56:20 +09:00
parent 0d098403f1
commit f480e23717
2 changed files with 15 additions and 2 deletions

2
bot.py
View File

@@ -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

View File

@@ -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",