reduce complexity
inside start_download_data() in an effort to appease flake8
This commit is contained in:
parent
d79983c791
commit
ff531c416f
@ -12,7 +12,7 @@ from freqtrade.enums import CandleType, RunMode, TradingMode
|
|||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.exchange import timeframe_to_minutes
|
from freqtrade.exchange import timeframe_to_minutes
|
||||||
from freqtrade.exchange.exchange import market_is_active
|
from freqtrade.exchange.exchange import market_is_active
|
||||||
from freqtrade.plugins.pairlist.pairlist_helpers import expand_pairlist
|
from freqtrade.plugins.pairlist.pairlist_helpers import dynamic_expand_pairlist, expand_pairlist
|
||||||
from freqtrade.resolvers import ExchangeResolver
|
from freqtrade.resolvers import ExchangeResolver
|
||||||
|
|
||||||
|
|
||||||
@ -50,12 +50,8 @@ def start_download_data(args: Dict[str, Any]) -> None:
|
|||||||
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config, validate=False)
|
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config, validate=False)
|
||||||
markets = [p for p, m in exchange.markets.items() if market_is_active(m)
|
markets = [p for p, m in exchange.markets.items() if market_is_active(m)
|
||||||
or config.get('include_inactive')]
|
or config.get('include_inactive')]
|
||||||
if config.get('freqai', {}):
|
|
||||||
full_pairs = config['pairs'] + [pair for pair in config['freqai']['corr_pairlist']
|
expanded_pairs = dynamic_expand_pairlist(config, markets)
|
||||||
if pair not in config['pairs']]
|
|
||||||
expanded_pairs = expand_pairlist(full_pairs, markets)
|
|
||||||
else:
|
|
||||||
expanded_pairs = expand_pairlist(config['pairs'], markets)
|
|
||||||
|
|
||||||
# Manual validations of relevant settings
|
# Manual validations of relevant settings
|
||||||
if not config['exchange'].get('skip_pair_validation', False):
|
if not config['exchange'].get('skip_pair_validation', False):
|
||||||
|
@ -40,3 +40,14 @@ def expand_pairlist(wildcardpl: List[str], available_pairs: List[str],
|
|||||||
except re.error as err:
|
except re.error as err:
|
||||||
raise ValueError(f"Wildcard error in {pair_wc}, {err}")
|
raise ValueError(f"Wildcard error in {pair_wc}, {err}")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def dynamic_expand_pairlist(config: dict, markets: list) -> List[str]:
|
||||||
|
if config.get('freqai', {}):
|
||||||
|
full_pairs = config['pairs'] + [pair for pair in config['freqai']['corr_pairlist']
|
||||||
|
if pair not in config['pairs']]
|
||||||
|
expanded_pairs = expand_pairlist(full_pairs, markets)
|
||||||
|
else:
|
||||||
|
expanded_pairs = expand_pairlist(config['pairs'], markets)
|
||||||
|
|
||||||
|
return expanded_pairs
|
||||||
|
Loading…
Reference in New Issue
Block a user