]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
test(ReforceXY): use proper constants
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 25 Dec 2025 18:51:46 +0000 (19:51 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 25 Dec 2025 18:51:46 +0000 (19:51 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ReforceXY/reward_space_analysis/tests/constants.py
ReforceXY/reward_space_analysis/tests/integration/test_report_formatting.py
ReforceXY/reward_space_analysis/tests/integration/test_reward_calculation.py

index cdeefa73843e6e331263f29d2601c4a21664993d..750dc93f37238f8e8b08dc1a6eac02f868f3e6b7 100644 (file)
@@ -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
index b928cb827d5e1aabeda07d8543686ed25a1c14b6..757531c88e11147c8462b5d825965805d0c6ba0f 100644 (file)
@@ -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)
index 467fa2317ee40f3266604c5679c466de99b2a03a..5c633007485a161c04c1ee516f8edeabfe5cdf3d 100644 (file)
@@ -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")]: