fix: improved handling for corrupt trades files

part of #10515
This commit is contained in:
Matthias 2024-08-10 17:51:46 +02:00
parent f5ebfcca5a
commit 0afd3fc5e1
2 changed files with 8 additions and 4 deletions

View File

@ -247,9 +247,13 @@ class IDataHandler(ABC):
:param timerange: Timerange to load trades for - currently not implemented
:return: List of trades
"""
trades = trades_df_remove_duplicates(
self._trades_load(pair, trading_mode, timerange=timerange)
)
try:
trades = self._trades_load(pair, trading_mode, timerange=timerange)
except Exception:
logger.exception(f"Error loading trades for {pair}")
return DataFrame(columns=DEFAULT_TRADES_COLUMNS)
trades = trades_df_remove_duplicates(trades)
trades = trades_convert_types(trades)
return trades

View File

@ -546,7 +546,7 @@ class Exchange:
else:
return self._trades[pair_interval]
else:
return DataFrame()
return DataFrame(columns=DEFAULT_TRADES_COLUMNS)
def get_contract_size(self, pair: str) -> Optional[float]:
if self.trading_mode == TradingMode.FUTURES: