Fixed an assert error

This commit is contained in:
Mohammad Dashti 2021-09-16 14:06:05 -07:00
parent 25a3d94de9
commit 938c04c4b2

View File

@ -1530,7 +1530,7 @@ class Exchange:
logger.debug("Cached the intermediate trades in %s", tmpdata_file)
else:
from_id = trades_list[0][1] if trades_list else 0
assert datadir is not None
datadir = datadir or ""
tmpdata_file = self._intermediate_trades_file(datadir, pair, from_id)
logger.debug("DID NOT CACHE the intermediate trades in %s with len=%s",
tmpdata_file, len(trades_list))
@ -1583,11 +1583,11 @@ class Exchange:
trades.extend(t[:-1])
while True:
assert from_id is not None
assert datadir is not None
tmpdata_file = self._intermediate_trades_file(datadir, pair, from_id)
t = []
success_cache_read = False
if datadir:
tmpdata_file = self._intermediate_trades_file(datadir, pair, from_id)
if os.path.isfile(tmpdata_file):
t = await self._async_fetch_trades_from_file(tmpdata_file)
@ -1598,7 +1598,8 @@ class Exchange:
success_cache_read = True
from_id = t[0][1]
to_id = t[-1][1]
logger.debug("Read from cache %s from %s to %s", tmpdata_file, from_id, to_id)
logger.debug(
"Read from cache %s from %s to %s", tmpdata_file, from_id, to_id)
if not success_cache_read:
t = await self._async_fetch_trades(pair,