Remove get_wallet_health
This commit is contained in:
parent
6bd606eb3e
commit
9f35d74e1d
@ -175,8 +175,8 @@ def get_pair_detail_url(pair: str) -> str:
|
||||
return _API.get_pair_detail_url(pair)
|
||||
|
||||
|
||||
def get_markets() -> List[str]:
|
||||
return _API.get_markets()
|
||||
def get_markets() -> List[dict]:
|
||||
return _API.fetch_markets()
|
||||
|
||||
|
||||
def get_market_summaries() -> List[Dict]:
|
||||
@ -189,15 +189,3 @@ def get_name() -> str:
|
||||
|
||||
def get_fee() -> float:
|
||||
return _API.calculate_fee('ETH/BTC', '', '', 1, 1)['rate']
|
||||
|
||||
|
||||
def get_wallet_health() -> List[Dict]:
|
||||
data = _API.request('Currencies/GetWalletHealth', api='v2')
|
||||
if not data['success']:
|
||||
raise OperationalException('{}'.format(data['message']))
|
||||
return [{
|
||||
'Currency': entry['Health']['Currency'],
|
||||
'IsActive': entry['Health']['IsActive'],
|
||||
'LastChecked': entry['Health']['LastChecked'],
|
||||
'Notice': entry['Currency'].get('Notice'),
|
||||
} for entry in data['result']]
|
||||
|
@ -156,17 +156,3 @@ class Exchange(ABC):
|
||||
...
|
||||
]
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def get_wallet_health(self) -> List[Dict]:
|
||||
"""
|
||||
Returns a list of all wallet health information
|
||||
:return: list, format: [
|
||||
{
|
||||
'Currency': str,
|
||||
'IsActive': bool,
|
||||
'LastChecked': str,
|
||||
'Notice': str
|
||||
},
|
||||
...
|
||||
"""
|
||||
|
@ -33,21 +33,23 @@ def refresh_whitelist(whitelist: List[str]) -> List[str]:
|
||||
:return: the list of pairs the user wants to trade without the one unavailable or black_listed
|
||||
"""
|
||||
sanitized_whitelist = whitelist
|
||||
health = exchange.get_wallet_health()
|
||||
markets = exchange.get_markets()
|
||||
|
||||
markets = [m for m in markets if m['quote'] == _CONF['stake_currency']]
|
||||
known_pairs = set()
|
||||
for status in health:
|
||||
pair = '{}_{}'.format(_CONF['stake_currency'], status['Currency'])
|
||||
for market in markets:
|
||||
pair = market['symbol']
|
||||
# pair is not int the generated dynamic market, or in the blacklist ... ignore it
|
||||
if pair not in whitelist or pair in _CONF['exchange'].get('pair_blacklist', []):
|
||||
continue
|
||||
# else the pair is valid
|
||||
known_pairs.add(pair)
|
||||
# Market is not active
|
||||
if not status['IsActive']:
|
||||
if not market['active']:
|
||||
sanitized_whitelist.remove(pair)
|
||||
logger.info(
|
||||
'Ignoring %s from whitelist (reason: %s).',
|
||||
pair, status.get('Notice') or 'wallet is not active'
|
||||
'Ignoring %s from whitelist. Market is not active.',
|
||||
pair
|
||||
)
|
||||
|
||||
# We need to remove pairs that are unknown
|
||||
|
Loading…
Reference in New Issue
Block a user