]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): missing import
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 8 Aug 2025 11:28:15 +0000 (13:28 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 8 Aug 2025 11:28:15 +0000 (13:28 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ReforceXY/user_data/freqaimodels/ReforceXY.py
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py

index de8a6df083d04c667f6bbca0e92a4630234c7208..03d5560ae4d1987a66c8e17ec39c3897b4b570cf 100644 (file)
@@ -401,7 +401,7 @@ class ReforceXY(BaseReinforcementLearningModel):
                 )
                 return best_model
             except Exception as e:
-                logger.error(f"Error loading best model: {e}", exc_info=True)
+                logger.error(f"Error loading best model: {repr(e)}", exc_info=True)
 
         logger.info("Couldn't find best model, using final model instead.")
 
@@ -568,7 +568,7 @@ class ReforceXY(BaseReinforcementLearningModel):
         except Exception as e:
             time_spent = time.time() - start_time
             logger.error(
-                f"Hyperopt {study_name} failed ({time_spent:.2f} secs): {e}",
+                f"Hyperopt {study_name} failed ({time_spent:.2f} secs): {repr(e)}",
                 exc_info=True,
             )
             hyperopt_failed = True
@@ -634,7 +634,7 @@ class ReforceXY(BaseReinforcementLearningModel):
                 json.dump(best_trial_params, write_file, indent=4)
         except Exception as e:
             logger.error(
-                f"Error saving best trial params to {best_trial_params_path}: {e}",
+                f"Error saving best trial params to {best_trial_params_path}: {repr(e)}",
                 exc_info=True,
             )
             raise
index fba0e280dc40a7e14e8316a7749d4ed254a48ae4..87feb225ce97ae9c6ff49cfd3b803e79bab991c2 100644 (file)
@@ -26,6 +26,7 @@ from Utils import (
     get_optuna_study_model_parameters,
     largest_divisor,
     round_to_nearest_int,
+    soft_extremum,
     zigzag,
 )
 
@@ -394,7 +395,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                 callback()
             except Exception as e:
                 logger.error(
-                    f"Error executing optuna {pair} {namespace} callback: {str(e)}",
+                    f"Error executing optuna {pair} {namespace} callback: {repr(e)}",
                     exc_info=True,
                 )
             finally:
@@ -644,7 +645,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
             return threshold_func(values)
         except Exception as e:
             logger.warning(
-                f"Failed to apply skimage threshold function {threshold_func.__name__} on series {series.name}: {str(e)}. Falling back to median",
+                f"Failed to apply skimage threshold function {threshold_func.__name__} on series {series.name}: {repr(e)}. Falling back to median",
                 exc_info=True,
             )
             return np.median(values)
@@ -971,7 +972,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
         except Exception as e:
             time_spent = time.time() - start_time
             logger.error(
-                f"Optuna {pair} {namespace} {objective_type} objective hyperopt failed ({time_spent:.2f} secs): {str(e)}",
+                f"Optuna {pair} {namespace} {objective_type} objective hyperopt failed ({time_spent:.2f} secs): {repr(e)}",
                 exc_info=True,
             )
             return
@@ -1016,6 +1017,8 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                 )
             elif isinstance(value, (int, float)):
                 formatted_value = format_number(value)
+            else:
+                formatted_value = repr(value)
             logger.info(
                 f"Optuna {pair} {namespace} {objective_type} objective hyperopt | {key:>20s} : {formatted_value}"
             )
@@ -1063,7 +1066,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
             storage = self.optuna_storage(pair)
         except Exception as e:
             logger.error(
-                f"Failed to create optuna storage for study {study_name}: {str(e)}",
+                f"Failed to create optuna storage for study {study_name}: {repr(e)}",
                 exc_info=True,
             )
             return None
@@ -1089,7 +1092,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
             )
         except Exception as e:
             logger.error(
-                f"Failed to create optuna study {study_name}: {str(e)}", exc_info=True
+                f"Failed to create optuna study {study_name}: {repr(e)}", exc_info=True
             )
             return None
 
@@ -1129,7 +1132,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                 json.dump(self.get_optuna_params(pair, namespace), write_file, indent=4)
         except Exception as e:
             logger.error(
-                f"Failed to save optuna {namespace} best params for {pair}: {str(e)}",
+                f"Failed to save optuna {namespace} best params for {pair}: {repr(e)}",
                 exc_info=True,
             )
             raise
index 40bd39e4f03cbe168fe123bc30f08626388201f3..c55fb30e98e8f09d3401e074d40c10df26849236 100644 (file)
@@ -446,7 +446,7 @@ class QuickAdapterV3(IStrategy):
         try:
             return pattern.format(**duration)
         except (KeyError, ValueError) as e:
-            raise ValueError(f"Invalid pattern '{pattern}': {e}")
+            raise ValueError(f"Invalid pattern '{pattern}': {repr(e)}")
 
     def set_freqai_targets(
         self, dataframe: DataFrame, metadata: dict[str, Any], **kwargs
@@ -691,7 +691,7 @@ class QuickAdapterV3(IStrategy):
                     return trade_kama_natr_values[-1]
             except Exception as e:
                 logger.warning(
-                    f"Failed to calculate trade NATR KAMA for pair {pair}: {str(e)}. Falling back to last trade NATR value",
+                    f"Failed to calculate trade NATR KAMA for pair {pair}: {repr(e)}. Falling back to last trade NATR value",
                     exc_info=True,
                 )
         return label_natr.iloc[-1]
@@ -775,7 +775,7 @@ class QuickAdapterV3(IStrategy):
                 callback()
             except Exception as e:
                 logger.error(
-                    f"Error executing callback for {pair}: {str(e)}", exc_info=True
+                    f"Error executing callback for {pair}: {repr(e)}", exc_info=True
                 )
 
     def custom_stoploss(