Remove "fill_gaps" parameter. If there is existing saved data, bounds input in "--timerange" may be ignored if they would leave the cache with missing data.

This commit is contained in:
Kuy Krawczeniuk 2021-03-26 13:54:53 -07:00
parent b00f5f1b0e
commit 2d078b72dc

View File

@ -153,10 +153,9 @@ def _load_cached_data_for_updating(pair: str, timeframe: str, timerange: Optiona
def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *, def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *,
timeframe: str = '5m', timeframe: str = '5m',
since: datetime = None, until: datetime = None, since: datetime = None, until: datetime = None,
data_handler: IDataHandler = None, data_handler: IDataHandler = None) -> bool:
fill_gaps: bool = False) -> bool:
data_handler = get_datahandler(datadir, data_handler=data_handler) data_handler = get_datahandler(datadir, data_handler=data_handler)
@ -182,7 +181,6 @@ def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *,
f"{cached_end:%Y-%m-%d %H:%M:%S}" if not cached_end else 'None') f"{cached_end:%Y-%m-%d %H:%M:%S}" if not cached_end else 'None')
since_ms, until_ms = None, None since_ms, until_ms = None, None
if cached.empty: if cached.empty:
if since: if since:
since_ms = since.timestamp() * 1000 since_ms = since.timestamp() * 1000
@ -203,26 +201,12 @@ def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *,
"including overwriting existing data!") "including overwriting existing data!")
since_ms = since.timestamp() * 1000 since_ms = since.timestamp() * 1000
else: else:
if fill_gaps: since_ms = cached_end.timestamp() * 1000
since_ms = cached_end.timestamp() * 1000
else:
logger.warning("The timerange starts after cached "
"data. There will be a gap in the "
"saved data! Use --fill-gaps to "
"prevent this!")
since_ms = since.timestamp() * 1000
else: else:
since_ms = cached_end.timestamp() * 1000 since_ms = cached_end.timestamp() * 1000
if until: if until:
if until < cached_start: if until < cached_start:
if fill_gaps: until_ms = cached_start.timestamp() * 1000
until_ms = cached_start.timestamp() * 1000
else:
logger.warning("The timerange ends before the cached "
"data. There will be a gap in the "
"saved data! Use --fill-gaps to "
"prevent this!")
until_ms = until.timestamp() * 1000
elif cached_start < until <= cached_end: elif cached_start < until <= cached_end:
logger.warning("The timerange overlaps with cached data." logger.warning("The timerange overlaps with cached data."
" This may lead to unexpected outcomes " " This may lead to unexpected outcomes "