Ensure that timestamps are integers.

This commit is contained in:
Kuy Krawczeniuk 2021-03-26 16:04:13 -07:00
parent d58ae8a8c1
commit c425e46901
2 changed files with 6 additions and 6 deletions

View File

@ -176,8 +176,8 @@ def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *,
cached_start, cached_end = None, None cached_start, cached_end = None, None
if not cached.empty: if not cached.empty:
cached_start = cached.iloc[0]['date'].timestamp() cached_start = int(cached.iloc[0]['date'].timestamp())
cached_end = cached.iloc[-1]['date'].timestamp() cached_end = int(cached.iloc[-1]['date'].timestamp())
logger.debug("Cached Start: %s", logger.debug("Cached Start: %s",
f"{cached.iloc[0]['date']:%Y-%m-%d %H:%M:%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 since_ms, until_ms = None, None
if cached.empty: if cached.empty:
since_ms = (since if since else 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 until_ms = (until if until else
datetime.now(timezone.utc).timestamp()) * 1000 arrow.utcnow().int_timestamp) * 1000
else: else:
# Determine lower bound # Determine lower bound
if since: if since:
@ -207,7 +207,7 @@ def _download_pair_history(datadir: Path, exchange: Exchange, pair: str, *,
* 1000 * 1000
else: else:
# Default upper-bound is the current time. # 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, new_data = exchange.get_historic_ohlcv(pair=pair,
timeframe=timeframe, timeframe=timeframe,

View File

@ -739,7 +739,7 @@ class Exchange:
""" """
if not until_ms: 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( return asyncio.get_event_loop().run_until_complete(
self._async_get_historic_ohlcv(pair=pair, timeframe=timeframe, self._async_get_historic_ohlcv(pair=pair, timeframe=timeframe,