improve performance and documentation of spice-rack.

This commit is contained in:
robcaulk
2022-10-08 12:45:49 +02:00
parent d362332527
commit 06f4f2db0a
5 changed files with 75 additions and 7 deletions

View File

@@ -1262,7 +1262,7 @@ class FreqaiDataKitchen:
return file_exists
def spice_extractor(self, indicator: str, dataframe: DataFrame) -> npt.NDArray:
if indicator in dataframe:
if indicator in dataframe.columns:
return np.array(dataframe[indicator])
else:
logger.warning(f'User asked spice_rack for {indicator}, '

View File

@@ -4,7 +4,7 @@
"enabled": true,
"purge_old_models": true,
"train_period_days": 4,
"backtest_period_days": 2,
"backtest_period_days": 1,
"identifier": "spicy-id",
"feature_parameters": {
"include_timeframes": [

View File

@@ -160,14 +160,13 @@ def auto_populate_any_indicators(
if set_generalized_indicators:
df["%-day_of_week"] = (df["date"].dt.dayofweek + 1) / 7
df["%-hour_of_day"] = (df["date"].dt.hour + 1) / 25
df["&s-minima"] = 0
df["&s-maxima"] = 0
df["&s-extrema"] = 0
min_peaks = argrelextrema(df["close"].values, np.less, order=80)
max_peaks = argrelextrema(df["close"].values, np.greater, order=80)
for mp in min_peaks[0]:
df.at[mp, "&s-minima"] = 1
df.at[mp, "&s-extrema"] = -1
for mp in max_peaks[0]:
df.at[mp, "&s-maxima"] = 1
df.at[mp, "&s-extrema"] = 1
return df
@@ -222,7 +221,7 @@ def setup_freqai_spice_rack(config: dict, exchange: Optional[Exchange]) -> Dict[
config['freqai']['feature_parameters'].update({'include_timeframes': new_tfs})
config['freqai']['feature_parameters'].update({'include_corr_pairlist': new_corr_pairs})
config.update({"freqaimodel": 'LightGBMRegressorMultiTarget'})
config.update({"freqaimodel": 'LightGBMRegressor'})
return config
# Keep below for when we wish to download heterogeneously lengthed data for FreqAI.