import datetime
import hashlib
-import json
import logging
import math
from functools import cached_property, lru_cache, reduce
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]:
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()
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):
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)
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)