From 7dfee16e258dcacf90c426af0a89db4eaa211aa3 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 4 Dec 2024 07:09:09 +0100 Subject: [PATCH] chore: improved logic ordering in orderflow method --- freqtrade/data/converter/orderflow.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/freqtrade/data/converter/orderflow.py b/freqtrade/data/converter/orderflow.py index ff43d1c22..03775f97b 100644 --- a/freqtrade/data/converter/orderflow.py +++ b/freqtrade/data/converter/orderflow.py @@ -115,13 +115,6 @@ def populate_dataframe_with_trades( f"might be unfinished, because no finished trades at {candle_next}" ) - indices = dataframe.index[is_between].tolist() - # Add trades to each candle - trades_series.loc[indices] = [ - trades_grouped_df.drop(columns=["candle_start", "candle_end"]).to_dict( - orient="records" - ) - ] # Use caching mechanism if (candle_start, candle_next) in cached_grouped_trades: cache_entry = cached_grouped_trades[ @@ -136,6 +129,13 @@ def populate_dataframe_with_trades( ) continue + indices = dataframe.index[is_between].tolist() + # Add trades to each candle + trades_series.loc[indices] = [ + trades_grouped_df.drop(columns=["candle_start", "candle_end"]).to_dict( + orient="records" + ) + ] # Calculate orderflow for each candle orderflow = trades_to_volumeprofile_with_total_delta_bid_ask( trades_grouped_df, scale=config_orderflow["scale"]