From: Jérôme Benoit Date: Sun, 28 Sep 2025 22:01:04 +0000 (+0200) Subject: perf(qav3): slighly improve time complexity at pivots labeling X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c583234353d504839ee79ddd14c3c2786ee5bcdf;p=freqai-strategies.git perf(qav3): slighly improve time complexity at pivots labeling Signed-off-by: Jérôme Benoit --- diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index 692f524..ccefb83 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -506,6 +506,7 @@ def zigzag( indices: list[int] = df.index.tolist() thresholds: NDArray[np.floating] = natr_values * natr_ratio closes = df.get("close").to_numpy() + log_closes = np.log(closes) highs = df.get("high").to_numpy() lows = df.get("low").to_numpy() @@ -590,8 +591,8 @@ def zigzag( slope_ok_cache[cache_key] = False return slope_ok_cache[cache_key] - log_candidate_pivot_close = np.log(closes[candidate_pivot_pos]) - log_current_close = np.log(closes[pos]) + log_candidate_pivot_close = log_closes[candidate_pivot_pos] + log_current_close = log_closes[pos] log_slope_close = (log_current_close - log_candidate_pivot_close) / ( pos - candidate_pivot_pos