tests: fix
This commit is contained in:
@@ -5,7 +5,6 @@ Fetch daily-archived OHLCV data from https://data.binance.vision/
|
|||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
import io
|
import io
|
||||||
import itertools
|
|
||||||
import logging
|
import logging
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
@@ -14,6 +13,7 @@ import pandas as pd
|
|||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
from freqtrade.enums import CandleType
|
from freqtrade.enums import CandleType
|
||||||
|
from freqtrade.misc import chunks
|
||||||
from freqtrade.util.datetime_helpers import dt_from_ts, dt_now
|
from freqtrade.util.datetime_helpers import dt_from_ts, dt_now
|
||||||
|
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ async def _fetch_ohlcv(
|
|||||||
for date in date_range(start, end)
|
for date in date_range(start, end)
|
||||||
]
|
]
|
||||||
# the HTTP connections has been throttled by TCPConnector
|
# the HTTP connections has been throttled by TCPConnector
|
||||||
for batch in itertools.batched(coroutines, 1000):
|
for batch in chunks(coroutines, 1000):
|
||||||
results = await asyncio.gather(*batch)
|
results = await asyncio.gather(*batch)
|
||||||
for result in results:
|
for result in results:
|
||||||
if isinstance(result, BaseException):
|
if isinstance(result, BaseException):
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ def test_load_data_with_new_pair_1min(
|
|||||||
"""
|
"""
|
||||||
Test load_pair_history() with 1 min timeframe
|
Test load_pair_history() with 1 min timeframe
|
||||||
"""
|
"""
|
||||||
mocker.patch(f"{EXMS}.get_historic_ohlcv", return_value=ohlcv_history)
|
|
||||||
exchange = get_patched_exchange(mocker, default_conf)
|
exchange = get_patched_exchange(mocker, default_conf)
|
||||||
|
mocker.patch.object(exchange, "get_historic_ohlcv", return_value=ohlcv_history)
|
||||||
file = tmp_path / "MEME_BTC-1m.feather"
|
file = tmp_path / "MEME_BTC-1m.feather"
|
||||||
|
|
||||||
# do not download a new pair if refresh_pairs isn't set
|
# do not download a new pair if refresh_pairs isn't set
|
||||||
@@ -305,8 +305,8 @@ def test_load_cached_data_for_updating(mocker, testdatadir) -> None:
|
|||||||
def test_download_pair_history(
|
def test_download_pair_history(
|
||||||
ohlcv_history, mocker, default_conf, tmp_path, candle_type, subdir, file_tail
|
ohlcv_history, mocker, default_conf, tmp_path, candle_type, subdir, file_tail
|
||||||
) -> None:
|
) -> None:
|
||||||
mocker.patch(f"{EXMS}.get_historic_ohlcv", return_value=ohlcv_history)
|
|
||||||
exchange = get_patched_exchange(mocker, default_conf)
|
exchange = get_patched_exchange(mocker, default_conf)
|
||||||
|
mocker.patch.object(exchange, "get_historic_ohlcv", return_value=ohlcv_history)
|
||||||
file1_1 = tmp_path / f"{subdir}MEME_BTC-1m{file_tail}.feather"
|
file1_1 = tmp_path / f"{subdir}MEME_BTC-1m{file_tail}.feather"
|
||||||
file1_5 = tmp_path / f"{subdir}MEME_BTC-5m{file_tail}.feather"
|
file1_5 = tmp_path / f"{subdir}MEME_BTC-5m{file_tail}.feather"
|
||||||
file2_1 = tmp_path / f"{subdir}CFI_BTC-1m{file_tail}.feather"
|
file2_1 = tmp_path / f"{subdir}CFI_BTC-1m{file_tail}.feather"
|
||||||
@@ -356,8 +356,8 @@ def test_download_pair_history2(mocker, default_conf, testdatadir, ohlcv_history
|
|||||||
"freqtrade.data.history.datahandlers.featherdatahandler.FeatherDataHandler.ohlcv_store",
|
"freqtrade.data.history.datahandlers.featherdatahandler.FeatherDataHandler.ohlcv_store",
|
||||||
return_value=None,
|
return_value=None,
|
||||||
)
|
)
|
||||||
mocker.patch(f"{EXMS}.get_historic_ohlcv", return_value=ohlcv_history)
|
|
||||||
exchange = get_patched_exchange(mocker, default_conf)
|
exchange = get_patched_exchange(mocker, default_conf)
|
||||||
|
mocker.patch.object(exchange, "get_historic_ohlcv", return_value=ohlcv_history)
|
||||||
_download_pair_history(
|
_download_pair_history(
|
||||||
datadir=testdatadir,
|
datadir=testdatadir,
|
||||||
exchange=exchange,
|
exchange=exchange,
|
||||||
|
|||||||
Reference in New Issue
Block a user