handle empty markets from ccxt

This commit is contained in:
hroff-1902 2019-07-03 12:50:27 +03:00
parent d2f0bf6ef6
commit be70c4f959
2 changed files with 14 additions and 8 deletions

View File

@ -208,14 +208,16 @@ class Exchange(object):
if this was requested in parameters.
"""
markets = self.markets
if base_currency:
markets = {k: v for k, v in markets.items() if v['base'] == base_currency}
if quote_currency:
markets = {k: v for k, v in markets.items() if v['quote'] == quote_currency}
if pairs_only:
markets = {k: v for k, v in markets.items() if symbol_is_pair(v['symbol'])}
if active_only:
markets = {k: v for k, v in markets.items() if v['active']}
if markets is not None:
if base_currency:
markets = {k: v for k, v in markets.items() if v['base'] == base_currency}
if quote_currency:
markets = {k: v for k, v in markets.items() if v['quote'] == quote_currency}
if pairs_only:
markets = {k: v for k, v in markets.items() if symbol_is_pair(v['symbol'])}
if active_only:
markets = {k: v for k, v in markets.items() if v['active']}
return markets
def klines(self, pair_interval: Tuple[str, str], copy=True) -> DataFrame:

View File

@ -2,6 +2,7 @@ import logging
from argparse import Namespace
from typing import Any, Dict
from freqtrade import OperationalException
from freqtrade.configuration import Configuration
from freqtrade.exchange import available_exchanges, Exchange
from freqtrade.misc import plural
@ -67,6 +68,9 @@ def start_list_pairs(args: Namespace, pairs_only: bool = False) -> None:
pairs_only=pairs_only,
active_only=args.active_only)
if pairs is None:
raise OperationalException(f"No markets info available for exchange \"{exchange.name}\"")
if args.print_list:
# print data as a list
print(f"Exchange {exchange.name} has {len(pairs)} " +