Remove remaining CustomModel references

This commit is contained in:
Matthias 2022-07-23 16:06:46 +02:00
parent 62f7606d2c
commit 8a3cffcd1b
4 changed files with 7 additions and 13 deletions

View File

@ -166,7 +166,7 @@ config setup includes:
Features are added by the user inside the `populate_any_indicators()` method of the strategy 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 `&`. 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. 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. 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:`). 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 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. :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: if informative is None:
informative = self.dp.get_pair_dataframe(pair, tf) 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: The Freqai strategy requires the user to include the following lines of code in the strategy:
```python ```python
from freqtrade.freqai.strategy_bridge import CustomModel
def informative_pairs(self): def informative_pairs(self):
whitelist_pairs = self.dp.current_whitelist() 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)) informative_pairs.append((pair, tf))
return informative_pairs return informative_pairs
def bot_start(self):
self.model = CustomModel(self.config)
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
self.freqai_info = self.config["freqai"] 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 # the target mean/std values for each of the labels created by user in
# `populate_any_indicators()` for each training period. # `populate_any_indicators()` for each training period.
dataframe = self.model.bridge.start(dataframe, metadata, self) dataframe = self.freqai.start(dataframe, metadata, self)
return dataframe return dataframe
``` ```
@ -648,7 +644,7 @@ below this value. An example usage in the strategy may look something like:
dataframe["do_predict"], dataframe["do_predict"],
dataframe["target_upper_quantile"], dataframe["target_upper_quantile"],
dataframe["target_lower_quantile"], dataframe["target_lower_quantile"],
) = self.model.bridge.start(dataframe, metadata, self) ) = self.freqai.start(dataframe, metadata, self)
return dataframe return dataframe

View File

@ -19,7 +19,6 @@ class FreqaiExampleStrategy(IStrategy):
""" """
Example strategy showing how the user connects their own Example strategy showing how the user connects their own
IFreqaiModel to the strategy. Namely, the user uses: IFreqaiModel to the strategy. Namely, the user uses:
self.model = CustomModel(self.config)
self.freqai.start(dataframe, metadata) self.freqai.start(dataframe, metadata)
to make predictions on their data. populate_any_indicators() automatically to make predictions on their data. populate_any_indicators() automatically

View File

@ -76,7 +76,7 @@ def get_freqai_live_analyzed_dataframe(mocker, freqaiconf):
strategy = get_patched_freqai_strategy(mocker, freqaiconf) strategy = get_patched_freqai_strategy(mocker, freqaiconf)
exchange = get_patched_exchange(mocker, freqaiconf) exchange = get_patched_exchange(mocker, freqaiconf)
strategy.dp = DataProvider(freqaiconf, exchange) strategy.dp = DataProvider(freqaiconf, exchange)
freqai = strategy.model.bridge freqai = strategy.freqai
freqai.live = True freqai.live = True
freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd) freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd)
timerange = TimeRange.parse_timerange("20180110-20180114") timerange = TimeRange.parse_timerange("20180110-20180114")
@ -91,7 +91,7 @@ def get_freqai_analyzed_dataframe(mocker, freqaiconf):
exchange = get_patched_exchange(mocker, freqaiconf) exchange = get_patched_exchange(mocker, freqaiconf)
strategy.dp = DataProvider(freqaiconf, exchange) strategy.dp = DataProvider(freqaiconf, exchange)
strategy.freqai_info = freqaiconf.get("freqai", {}) strategy.freqai_info = freqaiconf.get("freqai", {})
freqai = strategy.model.bridge freqai = strategy.freqai
freqai.live = True freqai.live = True
freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd) freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd)
timerange = TimeRange.parse_timerange("20180110-20180114") timerange = TimeRange.parse_timerange("20180110-20180114")
@ -107,7 +107,7 @@ def get_ready_to_train(mocker, freqaiconf):
exchange = get_patched_exchange(mocker, freqaiconf) exchange = get_patched_exchange(mocker, freqaiconf)
strategy.dp = DataProvider(freqaiconf, exchange) strategy.dp = DataProvider(freqaiconf, exchange)
strategy.freqai_info = freqaiconf.get("freqai", {}) strategy.freqai_info = freqaiconf.get("freqai", {})
freqai = strategy.model.bridge freqai = strategy.freqai
freqai.live = True freqai.live = True
freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd) freqai.dk = FreqaiDataKitchen(freqaiconf, freqai.dd)
timerange = TimeRange.parse_timerange("20180110-20180114") timerange = TimeRange.parse_timerange("20180110-20180114")

View File

@ -16,7 +16,6 @@ class freqai_test_strat(IStrategy):
""" """
Example strategy showing how the user connects their own Example strategy showing how the user connects their own
IFreqaiModel to the strategy. Namely, the user uses: IFreqaiModel to the strategy. Namely, the user uses:
self.model = CustomModel(self.config)
self.freqai.start(dataframe, metadata) self.freqai.start(dataframe, metadata)
to make predictions on their data. populate_any_indicators() automatically to make predictions on their data. populate_any_indicators() automatically