diff --git a/requirements.txt b/requirements.txt index 3cc830290..4f4b30d0c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -38,6 +38,7 @@ sdnotify==0.3.2 # API Server fastapi==0.85.0 +pydantic>=1.8.0 uvicorn==0.18.3 pyjwt==2.5.0 aiofiles==22.1.0 diff --git a/setup.py b/setup.py index d3f9ea7c0..b3693c9f9 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ setup( 'joblib>=1.2.0', 'pyarrow; platform_machine != "armv7l"', 'fastapi', + 'pydantic>=1.8.0', 'uvicorn', 'psutil', 'pyjwt', diff --git a/tests/freqai/test_freqai_datakitchen.py b/tests/freqai/test_freqai_datakitchen.py index 023193818..f60b29bf1 100644 --- a/tests/freqai/test_freqai_datakitchen.py +++ b/tests/freqai/test_freqai_datakitchen.py @@ -71,7 +71,7 @@ def test_use_DBSCAN_to_remove_outliers(mocker, freqai_conf, caplog): freqai = make_data_dictionary(mocker, freqai_conf) # freqai_conf['freqai']['feature_parameters'].update({"outlier_protection_percentage": 1}) freqai.dk.use_DBSCAN_to_remove_outliers(predict=False) - assert log_has_re(r"DBSCAN found eps of 1.75", caplog) + assert log_has_re(r"DBSCAN found eps of 1\.7\d\.", caplog) def test_compute_distances(mocker, freqai_conf): diff --git a/tests/freqai/test_freqai_interface.py b/tests/freqai/test_freqai_interface.py index 3a200e0af..7f264b526 100644 --- a/tests/freqai/test_freqai_interface.py +++ b/tests/freqai/test_freqai_interface.py @@ -10,6 +10,7 @@ from freqtrade.data.dataprovider import DataProvider from freqtrade.enums import RunMode from freqtrade.freqai.data_kitchen import FreqaiDataKitchen from freqtrade.freqai.utils import download_all_data_for_training, get_required_data_timerange +from freqtrade.optimize.backtesting import Backtesting from freqtrade.persistence import Trade from freqtrade.plugins.pairlistmanager import PairListManager from tests.conftest import get_patched_exchange, log_has_re @@ -38,9 +39,6 @@ def test_extract_data_and_train_model_Standard(mocker, freqai_conf, model): if is_arm() and model == 'CatboostRegressor': pytest.skip("CatBoost is not supported on ARM") - if is_mac(): - pytest.skip("Reinforcement learning module not available on intel based Mac OS") - model_save_ext = 'joblib' freqai_conf.update({"freqaimodel": model}) freqai_conf.update({"timerange": "20180110-20180130"}) @@ -182,7 +180,6 @@ def test_extract_data_and_train_model_Classifiers(mocker, freqai_conf, model): ("LightGBMRegressor", 6, "freqai_test_strat"), ("XGBoostRegressor", 6, "freqai_test_strat"), ("CatboostRegressor", 6, "freqai_test_strat"), - ("ReinforcementLearner", 7, "freqai_rl_test_strat"), ("XGBoostClassifier", 6, "freqai_test_classifier"), ("LightGBMClassifier", 6, "freqai_test_classifier"), ("CatboostClassifier", 6, "freqai_test_classifier") @@ -195,37 +192,10 @@ def test_start_backtesting(mocker, freqai_conf, model, num_files, strat): if is_arm() and "Catboost" in model: pytest.skip("CatBoost is not supported on ARM") - if is_mac(): - pytest.skip("Reinforcement learning module not available on intel based Mac OS") - freqai_conf.update({"freqaimodel": model}) freqai_conf.update({"timerange": "20180120-20180130"}) freqai_conf.update({"strategy": strat}) - if 'ReinforcementLearner' in model: - - freqai_conf["freqai"].update({"model_training_parameters": { - "learning_rate": 0.00025, - "gamma": 0.9, - "verbose": 1 - }}) - freqai_conf["freqai"].update({"model_save_type": 'stable_baselines'}) - freqai_conf["freqai"]["rl_config"] = { - "train_cycles": 1, - "thread_count": 2, - "max_trade_duration_candles": 300, - "model_type": "PPO", - "policy_type": "MlpPolicy", - "max_training_drawdown_pct": 0.5, - "model_reward_parameters": { - "rr": 1, - "profit_aim": 0.02, - "win_reward_factor": 2 - }} - - if 'test_4ac' in model: - freqai_conf["freqaimodel_path"] = str(Path(__file__).parents[1] / "freqai" / "test_models") - strategy = get_patched_freqai_strategy(mocker, freqai_conf) exchange = get_patched_exchange(mocker, freqai_conf) strategy.dp = DataProvider(freqai_conf, exchange) @@ -245,7 +215,7 @@ def test_start_backtesting(mocker, freqai_conf, model, num_files, strat): model_folders = [x for x in freqai.dd.full_path.iterdir() if x.is_dir()] assert len(model_folders) == num_files - Trade.use_db = True + Backtesting.cleanup() shutil.rmtree(Path(freqai.dk.full_path))