bot.py order.py
This commit is contained in:
15
order.py
15
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",
|
||||
|
||||
Reference in New Issue
Block a user