diff --git a/bfxbot/bfxwrapper.py b/bfxbot/bfxwrapper.py index d58d1f6..1f1d373 100644 --- a/bfxbot/bfxwrapper.py +++ b/bfxbot/bfxwrapper.py @@ -26,6 +26,13 @@ class BfxWrapper(BfxRest): return await super().get_active_orders(symbol) + @retry() + async def get_trades(self, symbol, start, end): + if isinstance(symbol, Symbol): + symbol = str(symbol) + + return await super().get_trades(symbol, start, end) + async def get_current_prices(self, symbol) -> (float, float, float): if isinstance(symbol, Symbol): symbol = str(symbol) @@ -51,3 +58,8 @@ class BfxWrapper(BfxRest): balance += current_price * w.balance return balance + + async def get_balance_delta(self, symbol: Symbol, start: float, end: float): + trades = await self.get_trades(symbol, start, end) + + return sum([t.amount for t in trades])