added new command to return balance across all currencies

This commit is contained in:
Samuel Husso
2017-10-28 08:44:49 +03:00
parent 29de1645fe
commit dd78c62c3d
3 changed files with 29 additions and 0 deletions

View File

@@ -84,6 +84,8 @@ def get_balance(currency: str) -> float:
return EXCHANGE.get_balance(currency)
def get_balances():
return EXCHANGE.get_balances()
def get_ticker(pair: str) -> dict:
return EXCHANGE.get_ticker(pair)

View File

@@ -54,6 +54,12 @@ class Bittrex(Exchange):
raise RuntimeError('{}: {}'.format(self.name.upper(), data['message']))
return float(data['result']['Balance'] or 0.0)
def get_balances(self):
data = _API.get_balances()
if not data['success']:
raise RuntimeError('{}: {}'.format(self.name.upper(), data['message']))
return data['result']
def get_ticker(self, pair: str) -> dict:
data = _API.get_ticker(pair.replace('_', '-'))
if not data['success']: