bot.py order.py
This commit is contained in:
2
bot.py
2
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
|
||||
|
||||
|
||||
|
||||
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