]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
chore: remove unused json imports and fix line length formatting
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 1 May 2026 16:02:23 +0000 (18:02 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 1 May 2026 16:02:23 +0000 (18:02 +0200)
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py

index cd4d6108cf707688dfdac277892a0759c14f1363..73e424b18ff6736bcc1f8bd7f7108295b83e4ec4 100644 (file)
@@ -1,5 +1,4 @@
 import copy
-import json
 import logging
 import random
 import time
index e8351b75e297e0089bad6a77d0777a3cfb9b2471..2151e87351d7ff65f043797e2a488dcbcf9956a9 100644 (file)
@@ -1,6 +1,5 @@
 import datetime
 import hashlib
-import json
 import logging
 import math
 from functools import cached_property, lru_cache, reduce
@@ -169,6 +168,10 @@ class QuickAdapterV3(IStrategy):
         super().__init__(config, *args, **kwargs)
         migrate_config(self.config, logger)
 
+    @cached_property
+    def timeframe_minutes(self) -> int:
+        return timeframe_to_minutes(self.config.get("timeframe"))
+
     @staticmethod
     @lru_cache(maxsize=None)
     def _trade_directions_set() -> set[TradeDirection]:
@@ -179,10 +182,6 @@ class QuickAdapterV3(IStrategy):
     def _order_types_set() -> set[OrderType]:
         return set(QuickAdapterV3._ORDER_TYPES)
 
-    @cached_property
-    def timeframe_minutes(self) -> int:
-        return timeframe_to_minutes(self.config.get("timeframe"))
-
     @property
     def can_short(self) -> bool:
         return self.is_short_allowed()
@@ -1913,7 +1912,9 @@ class QuickAdapterV3(IStrategy):
         try:
             rho1, _ = pearsonr(x_centered[:-1], x_centered[1:])
         except (ValueError, TypeError) as exc:
-            logger.debug("[%s] pearsonr failed, using standard df: %r", "effective_df", exc)
+            logger.debug(
+                "[%s] pearsonr failed, using standard df: %r", "effective_df", exc
+            )
             return n - 1
 
         if not np.isfinite(rho1):
index 3d075c3b348fa7cc8c25c24cb815bbedb8986da5..e794082a35f11b773e9cf77efa0fd926be53d471 100644 (file)
@@ -2569,7 +2569,9 @@ def _optuna_suggest_int_from_range(
 def optuna_load_best_params(
     base_path: Path, pair: str, namespace: str
 ) -> Optional[dict[str, Any]]:
-    best_params_path = base_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
+    best_params_path = (
+        base_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
+    )
     if best_params_path.is_file():
         with best_params_path.open("r", encoding="utf-8") as read_file:
             return json.load(read_file)
@@ -2583,7 +2585,9 @@ def optuna_save_best_params(
     params: dict[str, Any],
     logger: Logger,
 ) -> None:
-    best_params_path = base_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
+    best_params_path = (
+        base_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
+    )
     try:
         with best_params_path.open("w", encoding="utf-8") as write_file:
             json.dump(params, write_file, indent=4)