refactor: move download klines count message

This commit is contained in:
Meng Xiangzhuo
2024-11-02 06:00:37 +08:00
parent e2ee7f7b2f
commit cf0f232635
4 changed files with 5 additions and 3 deletions

View File

@@ -284,6 +284,7 @@ def _download_pair_history(
candle_type=candle_type,
until_ms=until_ms if until_ms else None,
)
logger.info(f"Downloaded data for {pair} with length {len(new_dataframe)}.")
if data.empty:
data = new_dataframe
else:

View File

@@ -60,8 +60,8 @@ async def fetch_ohlcv(
if start >= end:
return DataFrame()
df = await _fetch_ohlcv(asset_type, symbol, timeframe, start, end, stop_on_404)
logger.info(
f"Downloaded data for {pair} from https://data.binance.vision/ with length {len(df)}."
logger.debug(
f"Downloaded data for {pair} from https://data.binance.vision with length {len(df)}."
)
except Exception as e:
logger.debug("An exception occurred", exc_info=e)

View File

@@ -2246,7 +2246,7 @@ class Exchange:
candle_type=candle_type,
)
)
logger.info(f"Downloaded data for {pair} from ccxt with length {len(data)}.")
logger.debug(f"Downloaded data for {pair} from ccxt with length {len(data)}.")
return ohlcv_to_dataframe(data, timeframe, pair, fill_missing=False, drop_incomplete=True)
async def _async_get_historic_ohlcv(

View File

@@ -2092,6 +2092,7 @@ def test___now_is_time_to_refresh(default_conf, mocker, exchange_name, time_mach
@pytest.mark.parametrize("candle_type", ["mark", ""])
@pytest.mark.parametrize("exchange_name", EXCHANGES)
def test_get_historic_ohlcv(default_conf, mocker, caplog, exchange_name, candle_type):
caplog.set_level(logging.DEBUG)
exchange = get_patched_exchange(mocker, default_conf, exchange=exchange_name)
pair = "ETH/BTC"
calls = 0