Change logmessages to match functions called
This commit is contained in:
parent
b981cfcaa0
commit
e503d811bd
@ -525,7 +525,7 @@ class Exchange(object):
|
|||||||
for p, ticker in tickers:
|
for p, ticker in tickers:
|
||||||
if p == pair:
|
if p == pair:
|
||||||
data.extend(ticker)
|
data.extend(ticker)
|
||||||
# Sort data again after extending the result - above calls return in "async order" order
|
# Sort data again after extending the result - above calls return in "async order"
|
||||||
data = sorted(data, key=lambda x: x[0])
|
data = sorted(data, key=lambda x: x[0])
|
||||||
logger.info("downloaded %s with length %s.", pair, len(data))
|
logger.info("downloaded %s with length %s.", pair, len(data))
|
||||||
return data
|
return data
|
||||||
@ -535,7 +535,7 @@ class Exchange(object):
|
|||||||
"""
|
"""
|
||||||
Refresh in-memory ohlcv asyncronously and set `_klines` with the result
|
Refresh in-memory ohlcv asyncronously and set `_klines` with the result
|
||||||
"""
|
"""
|
||||||
logger.debug("Refreshing klines for %d pairs", len(pair_list))
|
logger.debug("Refreshing ohlcv data for %d pairs", len(pair_list))
|
||||||
|
|
||||||
# Calculating ticker interval in second
|
# Calculating ticker interval in second
|
||||||
interval_in_sec = constants.TICKER_INTERVAL_MINUTES[ticker_interval] * 60
|
interval_in_sec = constants.TICKER_INTERVAL_MINUTES[ticker_interval] * 60
|
||||||
@ -547,7 +547,7 @@ class Exchange(object):
|
|||||||
arrow.utcnow().timestamp and pair in self._klines):
|
arrow.utcnow().timestamp and pair in self._klines):
|
||||||
input_coroutines.append(self._async_get_candle_history(pair, ticker_interval))
|
input_coroutines.append(self._async_get_candle_history(pair, ticker_interval))
|
||||||
else:
|
else:
|
||||||
logger.debug("Using cached klines data for %s ...", pair)
|
logger.debug("Using cached ohlcv data for %s ...", pair)
|
||||||
|
|
||||||
tickers = asyncio.get_event_loop().run_until_complete(
|
tickers = asyncio.get_event_loop().run_until_complete(
|
||||||
asyncio.gather(*input_coroutines, return_exceptions=True))
|
asyncio.gather(*input_coroutines, return_exceptions=True))
|
||||||
|
@ -807,7 +807,7 @@ def test_refresh_latest_ohlcv(mocker, default_conf, caplog) -> None:
|
|||||||
assert not exchange._klines
|
assert not exchange._klines
|
||||||
exchange.refresh_latest_ohlcv(['IOTA/ETH', 'XRP/ETH'], '5m')
|
exchange.refresh_latest_ohlcv(['IOTA/ETH', 'XRP/ETH'], '5m')
|
||||||
|
|
||||||
assert log_has(f'Refreshing klines for {len(pairs)} pairs', caplog.record_tuples)
|
assert log_has(f'Refreshing ohlcv data for {len(pairs)} pairs', caplog.record_tuples)
|
||||||
assert exchange._klines
|
assert exchange._klines
|
||||||
assert exchange._api_async.fetch_ohlcv.call_count == 2
|
assert exchange._api_async.fetch_ohlcv.call_count == 2
|
||||||
for pair in pairs:
|
for pair in pairs:
|
||||||
@ -825,7 +825,7 @@ def test_refresh_latest_ohlcv(mocker, default_conf, caplog) -> None:
|
|||||||
exchange.refresh_latest_ohlcv(['IOTA/ETH', 'XRP/ETH'], '5m')
|
exchange.refresh_latest_ohlcv(['IOTA/ETH', 'XRP/ETH'], '5m')
|
||||||
|
|
||||||
assert exchange._api_async.fetch_ohlcv.call_count == 2
|
assert exchange._api_async.fetch_ohlcv.call_count == 2
|
||||||
assert log_has(f"Using cached klines data for {pairs[0]} ...", caplog.record_tuples)
|
assert log_has(f"Using cached ohlcv data for {pairs[0]} ...", caplog.record_tuples)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
@ -854,7 +854,7 @@ async def test__async_get_candle_history(default_conf, mocker, caplog):
|
|||||||
assert res[0] == pair
|
assert res[0] == pair
|
||||||
assert res[1] == tick
|
assert res[1] == tick
|
||||||
assert exchange._api_async.fetch_ohlcv.call_count == 1
|
assert exchange._api_async.fetch_ohlcv.call_count == 1
|
||||||
assert not log_has(f"Using cached klines data for {pair} ...", caplog.record_tuples)
|
assert not log_has(f"Using cached ohlcv data for {pair} ...", caplog.record_tuples)
|
||||||
|
|
||||||
# exchange = Exchange(default_conf)
|
# exchange = Exchange(default_conf)
|
||||||
await async_ccxt_exception(mocker, default_conf, MagicMock(),
|
await async_ccxt_exception(mocker, default_conf, MagicMock(),
|
||||||
|
Loading…
Reference in New Issue
Block a user