backtest_live_models - refactoring after PR review
This commit is contained in:
@@ -7,9 +7,10 @@ from freqtrade.configuration import TimeRange
|
||||
from freqtrade.data.dataprovider import DataProvider
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
|
||||
from freqtrade.freqai.freqai_util import (get_full_model_path,
|
||||
get_pairs_timestamps_training_from_ready_models,
|
||||
get_timerange_from_ready_models)
|
||||
from freqtrade.freqai.freqai_util import (get_assets_timestamps_training_from_ready_models,
|
||||
get_full_models_path,
|
||||
get_timerange_and_assets_end_dates_from_ready_models,
|
||||
get_timerange_backtest_live_models)
|
||||
from tests.conftest import get_patched_exchange
|
||||
from tests.freqai.conftest import get_patched_freqai_strategy
|
||||
|
||||
@@ -48,17 +49,17 @@ def test_get_full_model_path(mocker, freqai_conf, model):
|
||||
freqai.extract_data_and_train_model(
|
||||
new_timerange, "ADA/BTC", strategy, freqai.dk, data_load_timerange)
|
||||
|
||||
model_path = get_full_model_path(freqai_conf)
|
||||
model_path = get_full_models_path(freqai_conf)
|
||||
assert model_path.is_dir() is True
|
||||
|
||||
|
||||
def test_get_pairs_timestamp_validation(mocker, freqai_conf):
|
||||
model_path = get_full_model_path(freqai_conf)
|
||||
model_path = get_full_models_path(freqai_conf)
|
||||
with pytest.raises(
|
||||
OperationalException,
|
||||
match=r'.*required to run backtest with the freqai-backtest-live-models.*'
|
||||
):
|
||||
get_pairs_timestamps_training_from_ready_models(model_path)
|
||||
get_assets_timestamps_training_from_ready_models(model_path)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('model', [
|
||||
@@ -94,12 +95,13 @@ def test_get_timerange_from_ready_models(mocker, freqai_conf, model):
|
||||
freqai.extract_data_and_train_model(
|
||||
new_timerange, "ADA/BTC", strategy, freqai.dk, data_load_timerange)
|
||||
|
||||
model_path = get_full_model_path(freqai_conf)
|
||||
model_path = get_full_models_path(freqai_conf)
|
||||
(backtesting_timerange,
|
||||
backtesting_string_timerange,
|
||||
pairs_end_dates) = get_timerange_from_ready_models(models_path=model_path)
|
||||
pairs_end_dates) = get_timerange_and_assets_end_dates_from_ready_models(models_path=model_path)
|
||||
|
||||
assert len(pairs_end_dates["ADA"]) == 2
|
||||
assert backtesting_string_timerange == '20180122-20180127'
|
||||
assert backtesting_timerange.startts == 1516579200
|
||||
assert backtesting_timerange.startts == 1516492800
|
||||
assert backtesting_timerange.stopts == 1516924800
|
||||
|
||||
backtesting_string_timerange = get_timerange_backtest_live_models(freqai_conf)
|
||||
assert backtesting_string_timerange == '20180121-20180126'
|
||||
|
Reference in New Issue
Block a user