Make no-data warning optional

This commit is contained in:
Matthias 2019-12-27 06:58:29 +01:00
parent b83487a70d
commit ec8fb5f308
1 changed files with 7 additions and 4 deletions

View File

@ -30,6 +30,7 @@ class IDataHandler(ABC):
fill_missing: bool = True, fill_missing: bool = True,
drop_incomplete: bool = True, drop_incomplete: bool = True,
startup_candles: int = 0, startup_candles: int = 0,
warn_no_data: bool = True
) -> DataFrame: ) -> DataFrame:
""" """
Load cached ticker history for the given pair. Load cached ticker history for the given pair.
@ -40,6 +41,7 @@ class IDataHandler(ABC):
:param fill_missing: Fill missing values with "No action"-candles :param fill_missing: Fill missing values with "No action"-candles
:param drop_incomplete: Drop last candle assuming it may be incomplete. :param drop_incomplete: Drop last candle assuming it may be incomplete.
:param startup_candles: Additional candles to load at the start of the period :param startup_candles: Additional candles to load at the start of the period
:param warn_no_data: Log a warning message when no data is found
:return: DataFrame with ohlcv data, or empty DataFrame :return: DataFrame with ohlcv data, or empty DataFrame
""" """
# Fix startup period # Fix startup period
@ -50,10 +52,11 @@ class IDataHandler(ABC):
pairdf = self._ohlcv_load(pair, timeframe, pairdf = self._ohlcv_load(pair, timeframe,
timerange=timerange_startup) timerange=timerange_startup)
if pairdf.empty: if pairdf.empty:
logger.warning( if warn_no_data:
f'No history data for pair: "{pair}", timeframe: {timeframe}. ' logger.warning(
'Use `freqtrade download-data` to download the data' f'No history data for pair: "{pair}", timeframe: {timeframe}. '
) 'Use `freqtrade download-data` to download the data'
)
return pairdf return pairdf
else: else:
enddate = pairdf.iloc[-1]['date'] enddate = pairdf.iloc[-1]['date']