reduce complexity of start_download_data() for flake8
This commit is contained in:
parent
aca03e38f6
commit
c31f322349
@ -11,7 +11,7 @@ from freqtrade.data.history import (convert_trades_to_ohlcv, refresh_backtest_oh
|
|||||||
refresh_backtest_trades_data)
|
refresh_backtest_trades_data)
|
||||||
from freqtrade.enums import CandleType, RunMode, TradingMode
|
from freqtrade.enums import CandleType, RunMode, TradingMode
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.exchange import market_is_active, timeframe_to_minutes
|
from freqtrade.exchange import Exchange, market_is_active, timeframe_to_minutes
|
||||||
from freqtrade.freqai.utils import setup_freqai_spice_rack
|
from freqtrade.freqai.utils import setup_freqai_spice_rack
|
||||||
from freqtrade.plugins.pairlist.pairlist_helpers import dynamic_expand_pairlist, expand_pairlist
|
from freqtrade.plugins.pairlist.pairlist_helpers import dynamic_expand_pairlist, expand_pairlist
|
||||||
from freqtrade.resolvers import ExchangeResolver
|
from freqtrade.resolvers import ExchangeResolver
|
||||||
@ -68,7 +68,19 @@ def start_download_data(args: Dict[str, Any]) -> None:
|
|||||||
exchange.validate_timeframes(timeframe)
|
exchange.validate_timeframes(timeframe)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
pairs_not_available = download_trades(exchange, expanded_pairs, config, timerange)
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sys.exit("SIGINT received, aborting ...")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if pairs_not_available:
|
||||||
|
logger.info(f"Pairs [{','.join(pairs_not_available)}] not available "
|
||||||
|
f"on exchange {exchange.name}.")
|
||||||
|
|
||||||
|
|
||||||
|
def download_trades(exchange: Exchange, expanded_pairs: list,
|
||||||
|
config: Dict[str, Any], timerange: TimeRange) -> list:
|
||||||
if config.get('download_trades'):
|
if config.get('download_trades'):
|
||||||
if config.get('trading_mode') == 'futures':
|
if config.get('trading_mode') == 'futures':
|
||||||
raise OperationalException("Trade download not supported for futures.")
|
raise OperationalException("Trade download not supported for futures.")
|
||||||
@ -100,13 +112,7 @@ def start_download_data(args: Dict[str, Any]) -> None:
|
|||||||
prepend=config.get('prepend_data', False)
|
prepend=config.get('prepend_data', False)
|
||||||
)
|
)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
return pairs_not_available
|
||||||
sys.exit("SIGINT received, aborting ...")
|
|
||||||
|
|
||||||
finally:
|
|
||||||
if pairs_not_available:
|
|
||||||
logger.info(f"Pairs [{','.join(pairs_not_available)}] not available "
|
|
||||||
f"on exchange {exchange.name}.")
|
|
||||||
|
|
||||||
|
|
||||||
def start_convert_trades(args: Dict[str, Any]) -> None:
|
def start_convert_trades(args: Dict[str, Any]) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user