From: Jérôme Benoit Date: Thu, 25 Dec 2025 18:51:46 +0000 (+0100) Subject: test(ReforceXY): use proper constants X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3158863e3735793a7542cef6121c74f99cb4bad5;p=freqai-strategies.git test(ReforceXY): use proper constants Signed-off-by: Jérôme Benoit --- diff --git a/ReforceXY/reward_space_analysis/tests/constants.py b/ReforceXY/reward_space_analysis/tests/constants.py index cdeefa7..750dc93 100644 --- a/ReforceXY/reward_space_analysis/tests/constants.py +++ b/ReforceXY/reward_space_analysis/tests/constants.py @@ -304,6 +304,7 @@ class TestScenarios: SAMPLE_SIZE_REPORT_MINIMAL: Minimal sample size for report smoke tests (10) REPORT_DURATION_SCALE_UP: Duration scale applied to synthetic real episodes (1.01) REPORT_DURATION_SCALE_DOWN: Duration scale applied to synthetic real episodes (0.99) + REPORT_PNL_MEAN_SHIFT: PnL mean shift applied to synthetic real episodes (0.001) # API smoke parameters API_MAX_IDLE_DURATION_CANDLES: Idle duration cap used in _sample_action tests (20) @@ -345,6 +346,7 @@ class TestScenarios: SAMPLE_SIZE_REPORT_MINIMAL: int = 10 REPORT_DURATION_SCALE_UP: float = 1.01 REPORT_DURATION_SCALE_DOWN: float = 0.99 + REPORT_PNL_MEAN_SHIFT: float = 0.001 # API smoke parameters API_MAX_IDLE_DURATION_CANDLES: int = 20 diff --git a/ReforceXY/reward_space_analysis/tests/integration/test_report_formatting.py b/ReforceXY/reward_space_analysis/tests/integration/test_report_formatting.py index b928cb8..757531c 100644 --- a/ReforceXY/reward_space_analysis/tests/integration/test_report_formatting.py +++ b/ReforceXY/reward_space_analysis/tests/integration/test_report_formatting.py @@ -115,7 +115,7 @@ class TestReportFormatting(RewardSpaceTestBase): synth_df = self.make_stats_df(n=SCENARIOS.SAMPLE_SIZE_TINY, seed=SEEDS.REPORT_FORMAT_1) # Real df: shift slightly (different mean) so metrics non-zero real_df = synth_df.copy() - real_df["pnl"] = real_df["pnl"] + PARAMS.PNL_DUR_VOL_SCALE # small mean shift + real_df["pnl"] = real_df["pnl"] + SCENARIOS.REPORT_PNL_MEAN_SHIFT # small mean shift real_df["trade_duration"] = real_df["trade_duration"] * SCENARIOS.REPORT_DURATION_SCALE_UP real_df["idle_duration"] = real_df["idle_duration"] * SCENARIOS.REPORT_DURATION_SCALE_DOWN content = self._write_report(synth_df, real_df=real_df) diff --git a/ReforceXY/reward_space_analysis/tests/integration/test_reward_calculation.py b/ReforceXY/reward_space_analysis/tests/integration/test_reward_calculation.py index 467fa23..5c63300 100644 --- a/ReforceXY/reward_space_analysis/tests/integration/test_reward_calculation.py +++ b/ReforceXY/reward_space_analysis/tests/integration/test_reward_calculation.py @@ -144,7 +144,7 @@ class TestRewardCalculation(RewardSpaceTestBase): params = self.base_params() params.pop("base_factor", None) base_factor = DEFAULT_MODEL_REWARD_PARAMETERS["base_factor"] - profit_aim = PARAMS.PNL_MEDIUM + profit_aim = PARAMS.PROFIT_AIM rr = PARAMS.RISK_REWARD_RATIO for pnl, label in [(PARAMS.PNL_SMALL, "profit"), (-PARAMS.PNL_SMALL, "loss")]: