https://github.com/sponsors/robcaulk
"""
- version = "3.7.16"
+ version = "3.7.17"
@cached_property
def _optuna_config(self) -> dict:
X_test,
y_test,
test_weights,
+ self.data_split_parameters.get("test_size", TEST_SIZE),
self.freqai_info.get("fit_live_predictions_candles", 100),
self._optuna_config.get("candles_step"),
model_training_parameters,
self.freqai_info.get("prediction_thresholds_temperature", 125.0)
)
extrema = pred_df[EXTREMA_COLUMN].iloc[
- -(
- (fit_live_predictions_candles // label_period_candles)
- * label_period_candles
+ -max(
+ label_period_candles,
+ int((fit_live_predictions_candles / 2) / label_period_candles)
+ * label_period_candles,
) :
]
min_pred = smoothed_min(extrema, temperature=temperature)
X_test: pd.DataFrame,
y_test: pd.DataFrame,
test_weights: np.ndarray,
+ test_size: float,
fit_live_predictions_candles: int,
candles_step: int,
model_training_parameters: dict,
) -> float:
- min_train_window: int = fit_live_predictions_candles * 2
+ min_train_window: int = fit_live_predictions_candles * int(1 / test_size)
max_train_window: int = len(X)
if max_train_window < min_train_window:
min_train_window = max_train_window
df = df.iloc[
-(
- (fit_live_predictions_candles // label_period_candles)
+ int(fit_live_predictions_candles / label_period_candles)
* label_period_candles
) :
]
current_natr = df["natr_label_period_candles"].iloc[-1]
if isna(current_natr):
return None
+ take_profit_natr_ratio = self.get_take_profit_natr_ratio(trade.pair)
trade_take_profit_distance = (
- trade.open_rate * entry_natr * self.get_take_profit_natr_ratio(trade.pair)
+ trade.open_rate * entry_natr * take_profit_natr_ratio
)
current_take_profit_distance = (
- current_rate * current_natr * self.get_take_profit_natr_ratio(trade.pair)
+ current_rate * current_natr * take_profit_natr_ratio
)
return (
max(