From c425e469011b7af0bde104cd28af5dc52514495f Mon Sep 17 00:00:00 2001 From: Kuy Krawczeniuk Date: Fri, 26 Mar 2021 16:04:13 -0700 Subject: [PATCH] Ensure that timestamps are integers. --- freqtrade/data/history/history_utils.py | 10 +++++----- freqtrade/exchange/exchange.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index eee421cf6..b137a4266 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -176,8 +176,8 @@ def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *, cached_start, cached_end = None, None if not cached.empty: - cached_start = cached.iloc[0]['date'].timestamp() - cached_end = cached.iloc[-1]['date'].timestamp() + cached_start = int(cached.iloc[0]['date'].timestamp()) + cached_end = int(cached.iloc[-1]['date'].timestamp()) logger.debug("Cached Start: %s", f"{cached.iloc[0]['date']:%Y-%m-%d %H:%M:%S}" @@ -190,9 +190,9 @@ def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *, since_ms, until_ms = None, None if cached.empty: since_ms = (since if since else - arrow.utcnow().shift(days=-30).timestamp()) * 1000 + arrow.utcnow().shift(days=-30).int_timestamp) * 1000 until_ms = (until if until else - datetime.now(timezone.utc).timestamp()) * 1000 + arrow.utcnow().int_timestamp) * 1000 else: # Determine lower bound if since: @@ -207,7 +207,7 @@ def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *, * 1000 else: # Default upper-bound is the current time. - until_ms = datetime.now(timezone.utc).timestamp() * 1000 + until_ms = arrow.utcnow().int_timestamp * 1000 new_data = exchange.get_historic_ohlcv(pair=pair, timeframe=timeframe, diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index f67248bd2..0c7ad3c5a 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -739,7 +739,7 @@ class Exchange: """ if not until_ms: - until_ms = datetime.now(timezone.utc).timestamp() * 1000 + until_ms = arrow.utcnow().int_timestamp * 1000 return asyncio.get_event_loop().run_until_complete( self._async_get_historic_ohlcv(pair=pair, timeframe=timeframe,