added get_balance_delta function in wrapper
This commit is contained in:
parent
fd54ae2ca2
commit
6c6d85ba78
@ -26,6 +26,13 @@ class BfxWrapper(BfxRest):
|
|||||||
|
|
||||||
return await super().get_active_orders(symbol)
|
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):
|
async def get_current_prices(self, symbol) -> (float, float, float):
|
||||||
if isinstance(symbol, Symbol):
|
if isinstance(symbol, Symbol):
|
||||||
symbol = str(symbol)
|
symbol = str(symbol)
|
||||||
@ -51,3 +58,8 @@ class BfxWrapper(BfxRest):
|
|||||||
balance += current_price * w.balance
|
balance += current_price * w.balance
|
||||||
|
|
||||||
return 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])
|
||||||
|
Loading…
Reference in New Issue
Block a user