From 8d0005529d1b27ffdde93e2f8f9a7a37cd30f4bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 5 Oct 2025 17:26:08 +0200 Subject: [PATCH] perf(qav3): tune reversal confirmation logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../reward_space_analysis/reward_space_analysis.py | 2 +- .../freqaimodels/QuickAdapterRegressorV3.py | 12 +++++++++++- quickadapter/user_data/strategies/QuickAdapterV3.py | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ReforceXY/reward_space_analysis/reward_space_analysis.py b/ReforceXY/reward_space_analysis/reward_space_analysis.py index d3d21e7..9e5849d 100644 --- a/ReforceXY/reward_space_analysis/reward_space_analysis.py +++ b/ReforceXY/reward_space_analysis/reward_space_analysis.py @@ -102,7 +102,7 @@ DEFAULT_MODEL_REWARD_PARAMETERS: Dict[str, float | str] = { # Efficiency keys (env defaults) "efficiency_weight": 0.75, "efficiency_center": 0.75, - # Profit factor params (env-compatible) + # Profit factor params (env defaults) "win_reward_factor": 2.0, "pnl_factor_beta": 0.5, } diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index a465b87..1ca6ee0 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -450,6 +450,12 @@ class QuickAdapterRegressorV3(BaseRegressionModel): ), fit_live_predictions_candles, self._optuna_config.get("label_candles_step"), + min_label_natr_ratio=self.ft_params.get( + "min_label_natr_ratio", 9.0 + ), + max_label_natr_ratio=self.ft_params.get( + "max_label_natr_ratio", 12.0 + ), ), directions=[ optuna.study.StudyDirection.MAXIMIZE, @@ -1759,6 +1765,8 @@ def label_objective( df: pd.DataFrame, fit_live_predictions_candles: int, candles_step: int, + min_label_natr_ratio: float = 9.0, + max_label_natr_ratio: float = 12.0, ) -> tuple[float, int]: min_label_period_candles, max_label_period_candles, candles_step = ( get_min_max_label_period_candles(fit_live_predictions_candles, candles_step) @@ -1770,7 +1778,9 @@ def label_objective( max_label_period_candles, step=candles_step, ) - label_natr_ratio = trial.suggest_float("label_natr_ratio", 9.0, 12.0, step=0.05) + label_natr_ratio = trial.suggest_float( + "label_natr_ratio", min_label_natr_ratio, max_label_natr_ratio, step=0.05 + ) label_period_cycles = fit_live_predictions_candles / label_period_candles df = df.iloc[-(max(2, int(label_period_cycles)) * label_period_candles) :] diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 9bec78f..73bd834 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -1149,8 +1149,8 @@ class QuickAdapterV3(IStrategy): side: str, order: Literal["entry", "exit"], rate: float, - min_natr_ratio_percent: float = 0.0095, - max_natr_ratio_percent: float = 0.025, + min_natr_ratio_percent: float = 0.009, + max_natr_ratio_percent: float = 0.03, lookback_period: int = 1, decay_ratio: float = 0.5, ) -> bool: -- 2.43.0