From ecd2118941bc107b56f3de68438674e1967e9a15 Mon Sep 17 00:00:00 2001 From: Joe Schr <8218910+TheJoeSchr@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:14:22 +0200 Subject: [PATCH] fix: copying orderflow dataframe from cache doesn't work --- freqtrade/data/converter/orderflow.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/freqtrade/data/converter/orderflow.py b/freqtrade/data/converter/orderflow.py index af6976e47..5ae4ad27f 100644 --- a/freqtrade/data/converter/orderflow.py +++ b/freqtrade/data/converter/orderflow.py @@ -111,7 +111,13 @@ def populate_dataframe_with_trades(config, dataframe, trades): # Use caching mechanism if (candle_start, candle_next) in cached_grouped_trades: cache_entry = cached_grouped_trades[(candle_start, candle_next)] - dataframe.loc[is_between] = cache_entry + # dataframe.loc[is_between] = cache_entry # doesn't take, so we need workaround: + # Create a dictionary of the column values to be assigned + update_dict = {c: cache_entry[c].iat[0] for c in cache_entry.columns} + # Assign the values using the update_dict + dataframe.loc[is_between, update_dict.keys()] = pd.DataFrame( + [update_dict], index=dataframe.loc[is_between].index + ) continue # Store trades in Series using integer indices