remove add pair to column from docs, fix keyerror bug and adjust hybrid strategy example

This commit is contained in:
Wagner Costa
2022-12-30 10:42:31 -03:00
parent b2bab68fba
commit b39fc6b924
5 changed files with 125 additions and 63 deletions

View File

@@ -1311,10 +1311,10 @@ class FreqaiDataKitchen:
for tf in tfs:
if tf not in base_dataframes:
base_dataframes[tf] = pd.DataFrame()
if not corr_dataframes.keys():
for p in pairs:
if p not in corr_dataframes:
corr_dataframes[p] = {}
for p in pairs:
if p not in corr_dataframes:
corr_dataframes[p] = {}
if tf not in corr_dataframes[p]:
corr_dataframes[p][tf] = pd.DataFrame()
if not prediction_dataframe.empty:

View File

@@ -272,11 +272,7 @@ class IFreqaiModel(ABC):
self.pair_it += 1
train_it = 0
pair = metadata["pair"]
populate_indicators = True
timerange = TimeRange.parse_timerange(self.dk.full_timerange)
self.dd.load_all_pair_histories(timerange, self.dk)
corr_df, base_df = self.dd.get_base_and_corr_dataframes(timerange, pair, dk)
# Loop enforcing the sliding window training/backtesting paradigm
# tr_train is the training time range e.g. 1 historical month
@@ -312,6 +308,9 @@ class IFreqaiModel(ABC):
dk.append_predictions(append_df)
else:
if populate_indicators:
timerange = TimeRange.parse_timerange(self.dk.full_timerange)
self.dd.load_all_pair_histories(timerange, self.dk)
corr_df, base_df = self.dd.get_base_and_corr_dataframes(timerange, pair, dk)
dataframe = self.dk.use_strategy_to_populate_indicators(
strategy, prediction_dataframe=dataframe, pair=metadata["pair"],
corr_dataframes=corr_df, base_dataframes=base_df