import logging
import json
-from typing import Any, Dict
+from typing import Any
from pathlib import Path
from lightgbm import LGBMRegressor
experiments, with a an objective of helping the community make smarter choices in their
ML journey.
- This strategy is experimental (as with all strategies released to sponsors). Do *not* expect
+ This freqaimodel is experimental (as with all models released to sponsors). Do *not* expect
returns. The goal is to demonstrate gratitude to people who support the project and to
help them find a good starting point for their own creativity.
and self.__optuna_config.get("enabled", False)
and self.data_split_parameters.get("test_size", TEST_SIZE) > 0
)
- self.__optuna_hp_rmse: Dict[str, float] = {}
- self.__optuna_period_rmse: Dict[str, float] = {}
- self.__optuna_hp_params: Dict[str, Dict] = {}
- self.__optuna_period_params: Dict[str, Dict] = {}
+ self.__optuna_hp_rmse: dict[str, float] = {}
+ self.__optuna_period_rmse: dict[str, float] = {}
+ self.__optuna_hp_params: dict[str, dict] = {}
+ self.__optuna_period_params: dict[str, dict] = {}
for pair in self.pairs:
self.__optuna_hp_rmse[pair] = -1
self.__optuna_period_rmse[pair] = -1
)
)
- def fit(self, data_dictionary: Dict, dk: FreqaiDataKitchen, **kwargs) -> Any:
+ def fit(self, data_dictionary: dict, dk: FreqaiDataKitchen, **kwargs) -> Any:
"""
User sets up the training and test data to fit their desired model here
:param data_dictionary: the dictionary constructed by DataHandler to hold
X_test,
y_test,
test_weights,
- ) -> tuple[Dict, float] | tuple[None, None]:
+ ) -> tuple[dict, float] | tuple[None, None]:
identifier = self.freqai_info.get("identifier")
study_namespace = "hp"
study_name = f"{identifier}-{study_namespace}-{pair}"
y_test,
test_weights,
model_training_parameters,
- ) -> tuple[Dict, float] | tuple[None, None]:
+ ) -> tuple[dict, float] | tuple[None, None]:
identifier = self.freqai_info.get("identifier")
study_namespace = "period"
study_name = f"{identifier}-{study_namespace}-{pair}"
return params, study.best_value
def optuna_save_best_params(
- self, pair: str, namespace: str, best_params: Dict
+ self, pair: str, namespace: str, best_params: dict
) -> None:
best_params_path = Path(
self.full_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
with best_params_path.open("w", encoding="utf-8") as write_file:
json.dump(best_params, write_file, indent=4)
- def optuna_load_best_params(self, pair: str, namespace: str) -> Dict | None:
+ def optuna_load_best_params(self, pair: str, namespace: str) -> dict | None:
best_params_path = Path(
self.full_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
)
import logging
import json
-from typing import Any, Dict
+from typing import Any
from pathlib import Path
from xgboost import XGBRegressor
experiments, with a an objective of helping the community make smarter choices in their
ML journey.
- This strategy is experimental (as with all strategies released to sponsors). Do *not* expect
+ This freqaimodel is experimental (as with all models released to sponsors). Do *not* expect
returns. The goal is to demonstrate gratitude to people who support the project and to
help them find a good starting point for their own creativity.
and self.__optuna_config.get("enabled", False)
and self.data_split_parameters.get("test_size", TEST_SIZE) > 0
)
- self.__optuna_hp_rmse: Dict[str, float] = {}
- self.__optuna_period_rmse: Dict[str, float] = {}
- self.__optuna_hp_params: Dict[str, Dict] = {}
- self.__optuna_period_params: Dict[str, Dict] = {}
+ self.__optuna_hp_rmse: dict[str, float] = {}
+ self.__optuna_period_rmse: dict[str, float] = {}
+ self.__optuna_hp_params: dict[str, dict] = {}
+ self.__optuna_period_params: dict[str, dict] = {}
for pair in self.pairs:
self.__optuna_hp_rmse[pair] = -1
self.__optuna_period_rmse[pair] = -1
)
)
- def fit(self, data_dictionary: Dict, dk: FreqaiDataKitchen, **kwargs) -> Any:
+ def fit(self, data_dictionary: dict, dk: FreqaiDataKitchen, **kwargs) -> Any:
"""
User sets up the training and test data to fit their desired model here
:param data_dictionary: the dictionary constructed by DataHandler to hold
X_test,
y_test,
test_weights,
- ) -> tuple[Dict, float] | tuple[None, None]:
+ ) -> tuple[dict, float] | tuple[None, None]:
identifier = self.freqai_info.get("identifier")
study_namespace = "hp"
study_name = f"{identifier}-{study_namespace}-{pair}"
y_test,
test_weights,
model_training_parameters,
- ) -> tuple[Dict, float] | tuple[None, None]:
+ ) -> tuple[dict, float] | tuple[None, None]:
identifier = self.freqai_info.get("identifier")
study_namespace = "period"
study_name = f"{identifier}-{study_namespace}-{pair}"
return params, study.best_value
def optuna_save_best_params(
- self, pair: str, namespace: str, best_params: Dict
+ self, pair: str, namespace: str, best_params: dict
) -> None:
best_params_path = Path(
self.full_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
with best_params_path.open("w", encoding="utf-8") as write_file:
json.dump(best_params, write_file, indent=4)
- def optuna_load_best_params(self, pair: str, namespace: str) -> Dict | None:
+ def optuna_load_best_params(self, pair: str, namespace: str) -> dict | None:
best_params_path = Path(
self.full_path / f"optuna-{namespace}-best-params-{pair.split('/')[0]}.json"
)
from technical.pivots_points import pivots_points
from technical.indicators import chaikin_money_flow
from freqtrade.persistence import Trade
-from scipy.signal import argrelmin, argrelmax, gaussian, convolve
+from scipy.signal import argrelmin, argrelmax
import numpy as np
import pandas_ta as pta
class QuickAdapterV3(IStrategy):
"""
- The following freqaimodel is released to sponsors of the non-profit FreqAI open-source project.
+ The following freqtrade strategy is released to sponsors of the non-profit FreqAI open-source project.
If you find the FreqAI project useful, please consider supporting it by becoming a sponsor.
We use sponsor money to help stimulate new features and to pay for running these public
experiments, with a an objective of helping the community make smarter choices in their
dataframe["minima_threshold"] = dataframe[MINIMA_THRESHOLD_COLUMN]
dataframe["maxima_threshold"] = dataframe[MAXIMA_THRESHOLD_COLUMN]
+
return dataframe
def populate_entry_trend(self, df: DataFrame, metadata: dict) -> DataFrame:
std=std
)
),
- "zero_phase_gaussian": zero_phase_gaussian(
- series=series, window=window, std=std
- ),
+ # "zero_phase_gaussian": zero_phase_gaussian(
+ # series=series, window=window, std=std
+ # ),
"boxcar": series.rolling(
window=window, win_type="boxcar", center=center
).mean(),
return 2 * ewma - ewma.ewm(span=timeperiod).mean()
-def zero_phase_gaussian(series: Series, window: int, std: float) -> Series:
- # Gaussian kernel
- kernel = gaussian(window, std=std)
- kernel /= kernel.sum()
-
- # Forward-backward convolution for zero phase lag
- padded_series = np.pad(series, (window // 2, window // 2), mode="edge")
- smoothed = convolve(padded_series, kernel, mode="valid")
- smoothed = convolve(smoothed[::-1], kernel, mode="valid")[::-1]
- return Series(smoothed, index=series.index)
-
-
def get_distance(p1: Series | float, p2: Series | float) -> Series | float:
return abs((p1) - (p2))