From 606f18e5c1c9043ba0954e215652e33e2413dc88 Mon Sep 17 00:00:00 2001 From: robcaulk Date: Mon, 30 May 2022 21:35:48 +0200 Subject: [PATCH] Add follow_mode feature so that secondary bots can be launched with the same identifier and load models trained by the leader --- .../config_freqai_futures.example.json | 10 +++- .../config_freqai_spot.example.json | 2 +- docs/freqai.md | 20 ++++++- freqtrade/freqai/data_drawer.py | 58 +++++++++++++++++-- freqtrade/freqai/freqai_interface.py | 25 ++++++-- 5 files changed, 99 insertions(+), 16 deletions(-) diff --git a/config_examples/config_freqai_futures.example.json b/config_examples/config_freqai_futures.example.json index cb545acdc..5cd867e53 100644 --- a/config_examples/config_freqai_futures.example.json +++ b/config_examples/config_freqai_futures.example.json @@ -66,7 +66,7 @@ ], "train_period": 20, "backtest_period": 2, - "identifier": "example", + "identifier": "example2", "live_trained_timestamp": 0, "corr_pairlist": [ "BTC/USDT:USDT", @@ -86,8 +86,14 @@ "random_state": 1 }, "model_training_parameters": { - "n_estimators": 1000, + "n_estimators": 200, "task_type": "CPU" } + }, + "bot_name": "", + "force_entry_enable": true, + "initial_state": "running", + "internals": { + "process_throttle_secs": 5 } } diff --git a/config_examples/config_freqai_spot.example.json b/config_examples/config_freqai_spot.example.json index e730335e9..0b4d4e7c5 100644 --- a/config_examples/config_freqai_spot.example.json +++ b/config_examples/config_freqai_spot.example.json @@ -56,7 +56,7 @@ "15m", "4h" ], - "train_period": 60, + "train_period": 30, "backtest_period": 7, "identifier": "example", "live_trained_timestamp": 0, diff --git a/docs/freqai.md b/docs/freqai.md index d6998a8b6..c4ac30415 100644 --- a/docs/freqai.md +++ b/docs/freqai.md @@ -391,7 +391,7 @@ Freqai will train an SVM on the training data (or components if the user activat `principal_component_analysis`) and remove any data point that it deems to be sit beyond the feature space. -## Stratifying the data +### Stratifying the data The user can stratify the training/testing data using: @@ -403,10 +403,26 @@ The user can stratify the training/testing data using: } ``` -which will split the data chronologically so that every X data points is a testing data point. In the +which will split the data chronologically so that every Xth data points is a testing data point. In the present example, the user is asking for every third data point in the dataframe to be used for testing, the other points are used for training. +### Setting up a follower + +The user can define: + +```json + "freqai": { + "follow_mode": true, + "identifier": "example" + } +``` + +to indicate to the bot that it should not train models, but instead should look for models trained +by a leader with the same `identifier`. In this example, the user has a leader bot with the +`identifier: "example"` already running or launching simultaneously as the present follower. +The follower will load models created by the leader and inference them to obtain predictions. +