From f5ebfcca5a9d7940154271dff133dbc132b0783d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 10 Aug 2024 17:11:20 +0200 Subject: [PATCH] chore: accept that trades dataframes may be empty for some reason part of #10515 --- freqtrade/data/converter/orderflow.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/freqtrade/data/converter/orderflow.py b/freqtrade/data/converter/orderflow.py index 11d17e52f..ca19a2622 100644 --- a/freqtrade/data/converter/orderflow.py +++ b/freqtrade/data/converter/orderflow.py @@ -78,6 +78,8 @@ def populate_dataframe_with_trades( # create columns for trades _init_dataframe_with_trades_columns(dataframe) + if trades is None or trades.empty: + return dataframe, cached_grouped_trades try: start_time = time.time() @@ -88,7 +90,7 @@ def populate_dataframe_with_trades( max_candles = config_orderflow["max_candles"] start_date = dataframe.tail(max_candles).date.iat[0] # slice of trades that are before current ohlcv candles to make groupby faster - trades = trades.loc[trades.candle_start >= start_date] + trades = trades.loc[trades["candle_start"] >= start_date] trades.reset_index(inplace=True, drop=True) # group trades by candle start