From c583234353d504839ee79ddd14c3c2786ee5bcdf Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 29 Sep 2025 00:01:04 +0200 Subject: [PATCH] perf(qav3): slighly improve time complexity at pivots labeling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- quickadapter/user_data/strategies/Utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 -- 2.43.0