Clarify exception on load when markets could not be loaded

closes #5498
This commit is contained in:
Matthias
2021-08-29 09:18:46 +02:00
parent 89581ad25c
commit 1895230afe
2 changed files with 16 additions and 2 deletions

View File

@@ -352,9 +352,16 @@ class Exchange:
def validate_stakecurrency(self, stake_currency: str) -> None:
"""
Checks stake-currency against available currencies on the exchange.
Only runs on startup. If markets have not been loaded, there's been a problem with
the connection to the exchange.
:param stake_currency: Stake-currency to validate
:raise: OperationalException if stake-currency is not available.
"""
if not self._markets:
raise OperationalException(
'Could not load markets, therefore cannot start. '
'Please investigate the above error for more details.'
)
quote_currencies = self.get_quote_currencies()
if stake_currency not in quote_currencies:
raise OperationalException(