adding get_free to wallet

This commit is contained in:
misagh
2018-11-24 16:37:28 +01:00
parent a9f04609d3
commit 29347a6931
3 changed files with 16 additions and 9 deletions

View File

@@ -26,12 +26,20 @@ class Wallets(object):
def __init__(self, exchange: Exchange) -> None:
self.exchange = exchange
if self.exchange._conf['dry_run']:
self.wallets: Dict[str, Any] = {'BTC': Wallet('Bittrex', 'BTC', 999.99, 100, 1000)}
else:
self.wallets: Dict[str, Any] = {}
self.wallets: Dict[str, Any] = {}
self.update()
def get_free(self, currency) -> float:
if self.exchange._conf['dry_run']:
return 999.9
balance = self.wallets.get(currency)
if balance and balance['free']:
return balance['free']
else:
return 0
def update(self) -> None:
balances = self.exchange.get_balances()