From cab82e8e606a8052a2c13ef8ffa10ab6945f4e12 Mon Sep 17 00:00:00 2001 From: initrv Date: Sun, 2 Apr 2023 02:59:02 +0300 Subject: [PATCH 1/7] Add sb3 learn progress bar --- config_examples/config_freqai.example.json | 3 ++- docs/freqai-parameter-table.md | 1 + freqtrade/constants.py | 1 + freqtrade/freqai/prediction_models/ReinforcementLearner.py | 3 ++- requirements-freqai-rl.txt | 3 +++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config_examples/config_freqai.example.json b/config_examples/config_freqai.example.json index 65a93379e..7878bd2c2 100644 --- a/config_examples/config_freqai.example.json +++ b/config_examples/config_freqai.example.json @@ -73,7 +73,8 @@ 10, 20 ], - "plot_feature_importances": 0 + "plot_feature_importances": 0, + "progress_bar": false }, "data_split_parameters": { "test_size": 0.33, diff --git a/docs/freqai-parameter-table.md b/docs/freqai-parameter-table.md index 9822a895a..fe265d483 100644 --- a/docs/freqai-parameter-table.md +++ b/docs/freqai-parameter-table.md @@ -85,6 +85,7 @@ Mandatory parameters are marked as **Required** and have to be set in one of the | `net_arch` | Network architecture which is well described in [`stable_baselines3` doc](https://stable-baselines3.readthedocs.io/en/master/guide/custom_policy.html#examples). In summary: `[, dict(vf=[], pi=[])]`. By default this is set to `[128, 128]`, which defines 2 shared hidden layers with 128 units each. | `randomize_starting_position` | Randomize the starting point of each episode to avoid overfitting.
**Datatype:** bool.
Default: `False`. | `drop_ohlc_from_features` | Do not include the normalized ohlc data in the feature set passed to the agent during training (ohlc will still be used for driving the environment in all cases)
**Datatype:** Boolean.
**Default:** `False` +| `progress_bar` | Display a progress bar with the current progress, elapsed time and estimated remaining time.
**Datatype:** Boolean.
Default: `False`. ### Additional parameters diff --git a/freqtrade/constants.py b/freqtrade/constants.py index ebb946221..00f072678 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -599,6 +599,7 @@ CONF_SCHEMA = { "policy_type": {"type": "string", "default": "MlpPolicy"}, "net_arch": {"type": "array", "default": [128, 128]}, "randomize_startinng_position": {"type": "boolean", "default": False}, + "progress_bar": {"type": "boolean", "default": False}, "model_reward_parameters": { "type": "object", "properties": { diff --git a/freqtrade/freqai/prediction_models/ReinforcementLearner.py b/freqtrade/freqai/prediction_models/ReinforcementLearner.py index e795703d4..a194c7290 100644 --- a/freqtrade/freqai/prediction_models/ReinforcementLearner.py +++ b/freqtrade/freqai/prediction_models/ReinforcementLearner.py @@ -71,7 +71,8 @@ class ReinforcementLearner(BaseReinforcementLearningModel): model.learn( total_timesteps=int(total_timesteps), - callback=[self.eval_callback, self.tensorboard_callback] + callback=[self.eval_callback, self.tensorboard_callback], + progress_bar=self.freqai_info["rl_config"]["progress_bar"] ) if Path(dk.data_path / "best_model.zip").is_file(): diff --git a/requirements-freqai-rl.txt b/requirements-freqai-rl.txt index 4de7d8fab..5d76b0600 100644 --- a/requirements-freqai-rl.txt +++ b/requirements-freqai-rl.txt @@ -8,3 +8,6 @@ sb3-contrib==1.7.0; python_version < '3.11' # Gym is forced to this version by stable-baselines3. setuptools==65.5.1 # Should be removed when gym is fixed. gym==0.21; python_version < '3.11' +# Progress bar for stable-baselines3 and sb3-contrib +tqdm==4.65.0; python_version < '3.11' +rich==13.3.3; python_version < '3.11' From 4c608e7167e0f7c349e92e5a844f5e3b9cb18ed0 Mon Sep 17 00:00:00 2001 From: initrv Date: Sun, 2 Apr 2023 03:12:24 +0300 Subject: [PATCH 2/7] remove misplaced param --- config_examples/config_freqai.example.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config_examples/config_freqai.example.json b/config_examples/config_freqai.example.json index 7878bd2c2..65a93379e 100644 --- a/config_examples/config_freqai.example.json +++ b/config_examples/config_freqai.example.json @@ -73,8 +73,7 @@ 10, 20 ], - "plot_feature_importances": 0, - "progress_bar": false + "plot_feature_importances": 0 }, "data_split_parameters": { "test_size": 0.33, From cfc04103888e27f4f9f27936bb4b74ad98fc06ba Mon Sep 17 00:00:00 2001 From: initrv Date: Sun, 2 Apr 2023 04:08:07 +0300 Subject: [PATCH 3/7] use rl_config get instead of freqai_info --- freqtrade/freqai/prediction_models/ReinforcementLearner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqai/prediction_models/ReinforcementLearner.py b/freqtrade/freqai/prediction_models/ReinforcementLearner.py index a194c7290..65990da87 100644 --- a/freqtrade/freqai/prediction_models/ReinforcementLearner.py +++ b/freqtrade/freqai/prediction_models/ReinforcementLearner.py @@ -72,7 +72,7 @@ class ReinforcementLearner(BaseReinforcementLearningModel): model.learn( total_timesteps=int(total_timesteps), callback=[self.eval_callback, self.tensorboard_callback], - progress_bar=self.freqai_info["rl_config"]["progress_bar"] + progress_bar=self.rl_config.get('progress_bar', False) ) if Path(dk.data_path / "best_model.zip").is_file(): From 6bc8759321b32e348268b7d36d9901428596abbe Mon Sep 17 00:00:00 2001 From: Robert Caulk Date: Sat, 15 Apr 2023 20:01:12 +0200 Subject: [PATCH 4/7] Update constants.py Make progress bar true by default --- freqtrade/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 0da6a3b18..b8e240419 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -600,7 +600,7 @@ CONF_SCHEMA = { "policy_type": {"type": "string", "default": "MlpPolicy"}, "net_arch": {"type": "array", "default": [128, 128]}, "randomize_starting_position": {"type": "boolean", "default": False}, - "progress_bar": {"type": "boolean", "default": False}, + "progress_bar": {"type": "boolean", "default": True}, "model_reward_parameters": { "type": "object", "properties": { From 864f53bc4b06a87893a3e641b65d448a75730f07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 03:57:23 +0000 Subject: [PATCH 5/7] Bump cryptography from 40.0.1 to 40.0.2 Bumps [cryptography](https://github.com/pyca/cryptography) from 40.0.1 to 40.0.2. - [Release notes](https://github.com/pyca/cryptography/releases) - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/40.0.1...40.0.2) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e09f8ba77..9e66e7f9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ pandas==1.5.3 pandas-ta==0.3.14b ccxt==3.0.59 -cryptography==40.0.1 +cryptography==40.0.2 aiohttp==3.8.4 SQLAlchemy==2.0.9 python-telegram-bot==13.15 From 7c95848271d1b1cada8057a240d429aae7ec5064 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 03:57:33 +0000 Subject: [PATCH 6/7] Bump rich from 13.3.3 to 13.3.4 Bumps [rich](https://github.com/Textualize/rich) from 13.3.3 to 13.3.4. - [Release notes](https://github.com/Textualize/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/Textualize/rich/compare/v13.3.3...v13.3.4) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e09f8ba77..620010234 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ jinja2==3.1.2 tables==3.8.0 blosc==1.11.1 joblib==1.2.0 -rich==13.3.3 +rich==13.3.4 pyarrow==11.0.0; platform_machine != 'armv7l' # find first, C search in arrays From d1b600e7b0c419d433c7b6bfc23aff4732cf9b12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 04:29:10 +0000 Subject: [PATCH 7/7] Bump fastapi from 0.95.0 to 0.95.1 Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.95.0 to 0.95.1. - [Release notes](https://github.com/tiangolo/fastapi/releases) - [Commits](https://github.com/tiangolo/fastapi/compare/0.95.0...0.95.1) --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e09f8ba77..a0a6e760f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,7 @@ orjson==3.8.10 sdnotify==0.3.2 # API Server -fastapi==0.95.0 +fastapi==0.95.1 pydantic==1.10.7 uvicorn==0.21.1 pyjwt==2.6.0