]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor: harmonize logging messages
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 27 Dec 2025 13:32:57 +0000 (14:32 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 27 Dec 2025 13:32:57 +0000 (14:32 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ReforceXY/reward_space_analysis/reward_space_analysis.py
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py

index a27edefe1eec4729a719c0cb373a05bd8f480e4a..606110f506a4f00cc9ce6d890c7dd205c7db4d81 100644 (file)
@@ -857,7 +857,7 @@ def _compute_time_attenuation_coefficient(
                 alpha = -math.log(tau) / _LOG_2
             else:
                 warnings.warn(
-                    f"Param: exit_power_tau={tau} outside (0,1]; falling back to alpha=1.0",
+                    f"Param: exit_power_tau={tau} outside (0,1]; falling back to 1.0",
                     RewardDiagnosticsWarning,
                     stacklevel=2,
                 )
@@ -905,7 +905,7 @@ def _compute_time_attenuation_coefficient(
         time_attenuation_coefficient = kernel(effective_dr)
     except Exception as e:
         warnings.warn(
-            f"Param: exit_attenuation_mode='{exit_attenuation_mode}' failed ({e!r}); falling back to linear",
+            f"Param: exit_attenuation_mode='{exit_attenuation_mode}' failed ({e!r}); falling back to 'linear'",
             RewardDiagnosticsWarning,
             stacklevel=2,
         )
@@ -972,7 +972,7 @@ def _get_exit_factor(
         if exit_factor_threshold > 0 and np.isfinite(exit_factor_threshold):  # noqa: SIM102
             if abs(exit_factor) > exit_factor_threshold:
                 warnings.warn(
-                    f"Param: |exit_factor|={abs(exit_factor):.2f} > threshold={exit_factor_threshold:.2f}",
+                    f"Param: |exit_factor|={abs(exit_factor):.6g} > threshold={exit_factor_threshold:.6g}",
                     RewardDiagnosticsWarning,
                     stacklevel=2,
                 )
@@ -1072,7 +1072,7 @@ def _compute_efficiency_coefficient(
     if efficiency_coefficient < 0.0:
         if _get_bool_param(params, "check_invariants"):
             warnings.warn(
-                f"Param: efficiency_coefficient={efficiency_coefficient:.4f} < 0; falling back to 0.0",
+                f"Param: efficiency_coefficient={efficiency_coefficient:.6g} < 0; falling back to 0.0",
                 RewardDiagnosticsWarning,
                 stacklevel=2,
             )
@@ -2734,7 +2734,7 @@ def _validate_bootstrap_results(
                 ci_low, ci_high = lower, upper
             results[metric] = (mean, ci_low, ci_high)
             warnings.warn(
-                f"Stats: bootstrap_ci for '{metric}' degenerate (width={width:.2e}); adjusted to epsilon={epsilon:.1e}",
+                f"Stats: bootstrap_ci for '{metric}' degenerate (width={width:.6g}); falling back to epsilon={epsilon:.6g}",
                 RewardDiagnosticsWarning,
                 stacklevel=2,
             )
index d24e9271f0009d124ad32bd8ce5fb6cd0471168e..e009236e1f94b4a7b6670cb951a8e89aca60e977 100644 (file)
@@ -535,7 +535,8 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
 
             label_weights = self.ft_params.get("label_weights")
             if label_weights is not None:
-                logger.info(f"  label_weights: {label_weights}")
+                formatted_label_weights = [format_number(w) for w in label_weights]
+                logger.info(f"  label_weights: [{', '.join(formatted_label_weights)}]")
             else:
                 logger.info(
                     "  label_weights: [1.0, ...] * n_objectives, l1 normalized (default)"
@@ -1081,7 +1082,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                 self.set_optuna_label_candle(pair)
                 self._optuna_label_candles[pair] = 0
         else:
-            logger.info(
+            logger.debug(
                 f"[{pair}] Optuna {namespace} callback throttled, still {optuna_label_remaining_candles} candles to go"
             )
         if len(self._optuna_label_incremented_pairs) >= len(self.pairs):
index 48d94757b802eade60bc0b08b7475c4f29497fe3..3d253ba1dc3fa4938bda4b9071247ff9915daecc 100644 (file)
@@ -376,7 +376,11 @@ class QuickAdapterV3(IStrategy):
 
         logger.info("Extrema Weighting:")
         logger.info(f"  strategy: {self.extrema_weighting['strategy']}")
-        logger.info(f"  source_weights: {self.extrema_weighting['source_weights']}")
+        formatted_source_weights = {
+            k: format_number(v)
+            for k, v in self.extrema_weighting["source_weights"].items()
+        }
+        logger.info(f"  source_weights: {formatted_source_weights}")
         logger.info(f"  aggregation: {self.extrema_weighting['aggregation']}")
         logger.info(
             f"  aggregation_normalization: {self.extrema_weighting['aggregation_normalization']}"
@@ -1699,7 +1703,7 @@ class QuickAdapterV3(IStrategy):
                 pair=trade.pair,
                 current_time=current_time,
                 callback=lambda: logger.info(
-                    f"Trade {trade.trade_direction} {trade.pair} stage {trade_exit_stage} | "
+                    f"[{trade.pair}] Trade {trade.trade_direction} stage {trade_exit_stage} | "
                     f"Take Profit: {format_number(trade_take_profit_price)}, Rate: {format_number(current_rate)}"
                 ),
             )
@@ -1717,7 +1721,7 @@ class QuickAdapterV3(IStrategy):
                 initial_trade_partial_stake_amount = trade_partial_stake_amount
                 trade_partial_stake_amount = trade.stake_amount - min_stake
                 logger.info(
-                    f"Trade {trade.trade_direction} {trade.pair} stage {trade_exit_stage} | "
+                    f"[{trade.pair}] Trade {trade.trade_direction} stage {trade_exit_stage} | "
                     f"Partial stake amount adjusted from {format_number(initial_trade_partial_stake_amount)} to {format_number(trade_partial_stake_amount)} to respect min_stake {format_number(min_stake)}"
                 )
             return (
@@ -2319,7 +2323,7 @@ class QuickAdapterV3(IStrategy):
                 pair=pair,
                 current_time=current_time,
                 callback=lambda: logger.info(
-                    f"Trade {trade.trade_direction} {trade.pair} stage {trade_exit_stage} | "
+                    f"[{trade.pair}] Trade {trade.trade_direction} stage {trade_exit_stage} | "
                     f"Take Profit: {format_number(trade_take_profit_price)}, Rate: {format_number(current_rate)}"
                 ),
             )
@@ -2393,7 +2397,7 @@ class QuickAdapterV3(IStrategy):
                 pair=pair,
                 current_time=current_time,
                 callback=lambda: logger.info(
-                    f"Trade {trade.trade_direction} {trade.pair} stage {trade_exit_stage} | "
+                    f"[{trade.pair}] Trade {trade.trade_direction} stage {trade_exit_stage} | "
                     f"Take Profit: {format_number(trade_take_profit_price)}, Rate: {format_number(current_rate)} | "
                     f"Declining: {trade_recent_pnl_declining} "
                     f"(tV:{format_number(t_trade_recent_velocity)}<=-t:{format_number(-t_crit_trade_recent_velocity)}, tA:{format_number(t_trade_recent_acceleration)}<=-t:{format_number(-t_crit_trade_recent_acceleration)})"