From: Jérôme Benoit Date: Wed, 4 Jun 2025 10:20:37 +0000 (+0200) Subject: fix(qav3): find_fractals must return the dataframe indices X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4f0e46e4e6f67e19d3b82e855f42ed54c09ecab4;p=freqai-strategies.git fix(qav3): find_fractals must return the dataframe indices Signed-off-by: Jérôme Benoit --- diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index 0c2cd95..943adf0 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -333,6 +333,8 @@ def find_fractals(df: pd.DataFrame, period: int = 2) -> tuple[list[int], list[in highs = df.get("high").to_numpy() lows = df.get("low").to_numpy() + indices = df.index.tolist() + fractal_highs = [] fractal_lows = [] @@ -347,9 +349,9 @@ def find_fractals(df: pd.DataFrame, period: int = 2) -> tuple[list[int], list[in ) if is_high_fractal: - fractal_highs.append(i) + fractal_highs.append(indices[i]) if is_low_fractal: - fractal_lows.append(i) + fractal_lows.append(indices[i]) return fractal_highs, fractal_lows