fix: Improve error message for download-data edgecase

hyperliquid doesn't provide historic data, neither klines nor trades.
This made the error message missleading.

closes #11270
This commit is contained in:
Matthias
2025-01-22 06:50:54 +01:00
parent 2b915a76df
commit f8f21cfc9c
2 changed files with 24 additions and 5 deletions

View File

@@ -679,11 +679,17 @@ def download_data(
)
else:
if not exchange.get_option("ohlcv_has_history", True):
raise OperationalException(
f"Historic klines not available for {exchange.name}. "
"Please use `--dl-trades` instead for this exchange "
"(will unfortunately take a long time)."
)
if not exchange.get_option("trades_has_history", True):
raise OperationalException(
f"Historic data not available for {exchange.name}. "
f"{exchange.name} does not support downloading trades or ohlcv data."
)
else:
raise OperationalException(
f"Historic klines not available for {exchange.name}. "
"Please use `--dl-trades` instead for this exchange "
"(will unfortunately take a long time)."
)
migrate_data(config, exchange)
pairs_not_available = refresh_backtest_ohlcv_data(
exchange,

View File

@@ -102,3 +102,16 @@ def test_download_data_main_data_invalid(mocker):
)
with pytest.raises(OperationalException, match=r"Historic klines not available for .*"):
download_data_main(config)
patch_exchange(mocker, exchange="hyperliquid")
mocker.patch(f"{EXMS}.get_markets", return_value={"ETH/USDC": {}})
config2 = setup_utils_configuration({"exchange": "hyperliquid"}, RunMode.UTIL_EXCHANGE)
config2.update(
{
"days": 20,
"pairs": ["ETH/USDC", "XRP/USDC"],
"timeframes": ["5m", "1h"],
}
)
with pytest.raises(OperationalException, match=r"Historic data not available for .*"):
download_data_main(config2)