fix: ensure data type is maintained when data comes from cache.

This commit is contained in:
Matthias
2024-12-06 20:05:33 +01:00
parent 6c25feabf2
commit ab39ac29e8

View File

@@ -113,10 +113,11 @@ def populate_dataframe_with_trades(
): ):
logger.info(f"Using cached orderflow data for {candle_start}") logger.info(f"Using cached orderflow data for {candle_start}")
# Check if the trades are already in the cache # Check if the trades are already in the cache
cache_idx = cached_grouped_trades.index[
cached_grouped_trades["date"] == candle_start
][0]
for col in ADDED_COLUMNS: for col in ADDED_COLUMNS:
dataframe.at[index, col] = cached_grouped_trades.loc[ dataframe.at[index, col] = cached_grouped_trades.at[cache_idx, col]
(cached_grouped_trades["date"] == candle_start), col
].values
continue continue
dataframe.at[index, "trades"] = trades_grouped_df.drop( dataframe.at[index, "trades"] = trades_grouped_df.drop(