start frequi with historical data if available
This commit is contained in:
parent
29b7b014e5
commit
a3799c4d5d
@ -229,20 +229,34 @@ class FreqaiDataDrawer:
|
|||||||
# dynamic df returned to strategy and plotted in frequi
|
# dynamic df returned to strategy and plotted in frequi
|
||||||
mrv_df = self.model_return_values[pair] = pd.DataFrame()
|
mrv_df = self.model_return_values[pair] = pd.DataFrame()
|
||||||
|
|
||||||
for label in dk.label_list:
|
# if user reused `idenfitier` in config and has historical predictions collected, loadthem
|
||||||
mrv_df[label] = pred_df[label]
|
# so that frequi remains uninterrupted after a crash
|
||||||
mrv_df[f"{label}_mean"] = dk.data["labels_mean"][label]
|
hist_df = self.historic_predictions
|
||||||
mrv_df[f"{label}_std"] = dk.data["labels_std"][label]
|
if pair in hist_df:
|
||||||
|
len_diff = len(hist_df[pair].index) - len(pred_df.index)
|
||||||
|
if len_diff < 0:
|
||||||
|
df_concat = pd.concat([pred_df.iloc[:abs(len_diff)], hist_df[pair]],
|
||||||
|
ignore_index=True, keys=hist_df[pair].keys())
|
||||||
|
else:
|
||||||
|
df_concat = hist_df[pair].tail(len(pred_df.index))
|
||||||
|
df_concat = df_concat.fillna(0)
|
||||||
|
self.model_return_values[pair] = df_concat
|
||||||
|
|
||||||
if self.freqai_info["feature_parameters"].get("DI_threshold", 0) > 0:
|
else:
|
||||||
mrv_df["DI_values"] = dk.DI_values
|
for label in dk.label_list:
|
||||||
|
mrv_df[label] = pred_df[label]
|
||||||
|
mrv_df[f"{label}_mean"] = dk.data["labels_mean"][label]
|
||||||
|
mrv_df[f"{label}_std"] = dk.data["labels_std"][label]
|
||||||
|
|
||||||
mrv_df["do_predict"] = do_preds
|
if self.freqai_info["feature_parameters"].get("DI_threshold", 0) > 0:
|
||||||
|
mrv_df["DI_values"] = dk.DI_values
|
||||||
|
|
||||||
if dk.data['extra_returns_per_train']:
|
mrv_df["do_predict"] = do_preds
|
||||||
rets = dk.data['extra_returns_per_train']
|
|
||||||
for return_str in rets:
|
if dk.data['extra_returns_per_train']:
|
||||||
mrv_df[return_str] = rets[return_str]
|
rets = dk.data['extra_returns_per_train']
|
||||||
|
for return_str in rets:
|
||||||
|
mrv_df[return_str] = rets[return_str]
|
||||||
|
|
||||||
# for keras type models, the conv_window needs to be prepended so
|
# for keras type models, the conv_window needs to be prepended so
|
||||||
# viewing is correct in frequi
|
# viewing is correct in frequi
|
||||||
|
Loading…
Reference in New Issue
Block a user