From 8a3cffcd1b80882d296c877d6b05198d3efacac5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 23 Jul 2022 16:06:46 +0200 Subject: [PATCH] Remove remaining CustomModel references --- docs/freqai.md | 12 ++++-------- freqtrade/templates/FreqaiExampleStrategy.py | 1 - tests/freqai/conftest.py | 6 +++--- tests/strategy/strats/freqai_test_strat.py | 1 - 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/docs/freqai.md b/docs/freqai.md index 5072d3721..48b8968a3 100644 --- a/docs/freqai.md +++ b/docs/freqai.md @@ -166,7 +166,7 @@ config setup includes: Features are added by the user inside the `populate_any_indicators()` method of the strategy by prepending indicators with `%` and labels are added by prepending `&`. There are some important components/structures that the user *must* include when building their feature set. -As shown below, `with self.model.bridge.lock:` must be used to ensure thread safety - especially when using third +As shown below, `with self.freqai.lock:` must be used to ensure thread safety - especially when using third party libraries for indicator construction such as TA-lib. Another structure to consider is the location of the labels at the bottom of the example function (below `if set_generalized_indicators:`). This is where the user will add single features and labels to their feature set to avoid duplication from @@ -191,7 +191,7 @@ various configuration parameters which multiply the feature set such as `include :coin: the name of the coin which will modify the feature names. """ - with self.model.bridge.lock: + with self.freqai.lock: if informative is None: informative = self.dp.get_pair_dataframe(pair, tf) @@ -370,7 +370,6 @@ for each pair, for each backtesting window within the bigger `--timerange`. The Freqai strategy requires the user to include the following lines of code in the strategy: ```python - from freqtrade.freqai.strategy_bridge import CustomModel def informative_pairs(self): whitelist_pairs = self.dp.current_whitelist() @@ -385,9 +384,6 @@ The Freqai strategy requires the user to include the following lines of code in informative_pairs.append((pair, tf)) return informative_pairs - def bot_start(self): - self.model = CustomModel(self.config) - def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: self.freqai_info = self.config["freqai"] @@ -400,7 +396,7 @@ The Freqai strategy requires the user to include the following lines of code in # the target mean/std values for each of the labels created by user in # `populate_any_indicators()` for each training period. - dataframe = self.model.bridge.start(dataframe, metadata, self) + dataframe = self.freqai.start(dataframe, metadata, self) return dataframe ``` @@ -648,7 +644,7 @@ below this value. An example usage in the strategy may look something like: dataframe["do_predict"], dataframe["target_upper_quantile"], dataframe["target_lower_quantile"], - ) = self.model.bridge.start(dataframe, metadata, self) + ) = self.freqai.start(dataframe, metadata, self) return dataframe diff --git a/freqtrade/templates/FreqaiExampleStrategy.py b/freqtrade/templates/FreqaiExampleStrategy.py index 86f141567..b3c2cc8d7 100644 --- a/freqtrade/templates/FreqaiExampleStrategy.py +++ b/freqtrade/templates/FreqaiExampleStrategy.py @@ -19,7 +19,6 @@ class FreqaiExampleStrategy(IStrategy): """ Example strategy showing how the user connects their own IFreqaiModel to the strategy. Namely, the user uses: - self.model = CustomModel(self.config) self.freqai.start(dataframe, metadata) to make predictions on their data. populate_any_indicators() automatically diff --git a/tests/freqai/conftest.py b/tests/freqai/conftest.py index 1d98fd863..1d0ea0e54 100644 --- a/tests/freqai/conftest.py +++ b/tests/freqai/conftest.py @@ -76,7 +76,7 @@ def get_freqai_live_analyzed_dataframe(mocker, freqaiconf): strategy = get_patched_freqai_strategy(mocker, freqaiconf) exchange = get_patched_exchange(mocker, freqaiconf) strategy.dp = DataProvider(freqaiconf, exchange) - freqai = strategy.model.bridge + freqai = strategy.freqai freqai.live = True freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd) timerange = TimeRange.parse_timerange("20180110-20180114") @@ -91,7 +91,7 @@ def get_freqai_analyzed_dataframe(mocker, freqaiconf): exchange = get_patched_exchange(mocker, freqaiconf) strategy.dp = DataProvider(freqaiconf, exchange) strategy.freqai_info = freqaiconf.get("freqai", {}) - freqai = strategy.model.bridge + freqai = strategy.freqai freqai.live = True freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd) timerange = TimeRange.parse_timerange("20180110-20180114") @@ -107,7 +107,7 @@ def get_ready_to_train(mocker, freqaiconf): exchange = get_patched_exchange(mocker, freqaiconf) strategy.dp = DataProvider(freqaiconf, exchange) strategy.freqai_info = freqaiconf.get("freqai", {}) - freqai = strategy.model.bridge + freqai = strategy.freqai freqai.live = True freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd) timerange = TimeRange.parse_timerange("20180110-20180114") diff --git a/tests/strategy/strats/freqai_test_strat.py b/tests/strategy/strats/freqai_test_strat.py index 221942bd3..49f00d6e2 100644 --- a/tests/strategy/strats/freqai_test_strat.py +++ b/tests/strategy/strats/freqai_test_strat.py @@ -16,7 +16,6 @@ class freqai_test_strat(IStrategy): """ Example strategy showing how the user connects their own IFreqaiModel to the strategy. Namely, the user uses: - self.model = CustomModel(self.config) self.freqai.start(dataframe, metadata) to make predictions on their data. populate_any_indicators() automatically