From a958d2f1207227f445d1513a8df72955ab00a7b1 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Wed, 16 Dec 2020 10:12:10 +0000 Subject: [PATCH] reordered methods in bfxbot. added stubs of close order and close position --- bfxbot/bfxbot.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/bfxbot/bfxbot.py b/bfxbot/bfxbot.py index cb3bbfa..6a777da 100644 --- a/bfxbot/bfxbot.py +++ b/bfxbot/bfxbot.py @@ -57,6 +57,21 @@ class BfxBot: ## TODO: handle _on_new_tick() from Strategy await self.__status[symbol].__add_event__(Event(EventKind.NEW_TICK, self.__ticker.current_tick)) + def close_order(self, symbol: Symbol, order_id: int): + raise NotImplementedError + + def close_position(self, symbol: Symbol, position_id: int): + raise NotImplementedError + + def set_strategy(self, symbol, strategy: Strategy): + if symbol in self.__status: + self.__status[symbol].strategy = strategy + else: + self.__status[symbol] = SymbolStatus(symbol, strategy) + + async def start(self): + await self.__update_status__() + def symbol_event_handler(self, symbol) -> EventHandler: if symbol not in self.__status: return None @@ -69,16 +84,7 @@ class BfxBot: return self.__status[symbol] - async def start(self): - await self.__update_status__() - async def update(self): sleep(self.__ticker.seconds) self.__ticker.inc() await self.__update_status__() - - def set_strategy(self, symbol, strategy: Strategy): - if symbol in self.__status: - self.__status[symbol].strategy = strategy - else: - self.__status[symbol] = SymbolStatus(symbol, strategy)