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 :param timerange: Timerange to load trades for - currently not implemented
:return: List of trades :return: List of trades
""" """
trades = trades_df_remove_duplicates( try:
self._trades_load(pair, trading_mode, timerange=timerange) 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) trades = trades_convert_types(trades)
return trades return trades

View File

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